### OData Filter Example with Arithmetic Operators Source: http://api.crmincloud.it Examples demonstrating the use of arithmetic operators within the $filter parameter for OData searches. ```url /api/latest/Company/Search?$filter=Billed+add+5+eq+15 ``` ```url /api/latest/Company/Search?$filter=Billed+sub+5+eq+25 ``` ```url /api/latest/Company/Search?$filter=Billed+mul+5+eq+100 ``` ```url /api/latest/Company/Search?$filter=Billed+div+5+eq+5 ``` ```url /api/latest/Company/Search?$filter=Billed+mod+5+eq+0 ``` -------------------------------- ### OData Filter Examples Source: http://api.crmincloud.it Examples demonstrating various string manipulation functions supported within OData $filter queries. ```APIDOC ## OData Filter String Functions ### Description Demonstrates the usage of various string manipulation functions within OData $filter queries for the Company Search endpoint. ### Method GET ### Endpoint /api/latest/Company/Search ### Query Parameters - **$filter** (string) - Required - OData filter expression. ### Examples of $filter expressions: - **startswith**: `/api/latest/Company/Search?$filter=startswith(companyName,'ACME')+eq+10` - **endswith**: `/api/latest/Company/Search?$filter=endswith(companyName,'srl')+eq+10` - **contains**: `/api/latest/Company/Search?$filter=contains(companyName,'srl')` - **length**: `/api/latest/Company/Search?$filter=length(companyName)+eq+10` - **indexof**: `/api/latest/Company/Search?$filter=indexof(companyName,'S')+eq+7` - **replace**: `/api/latest/Company/Search?$filter=replace(companyName,'srl','s.r.l.')+eq+'acme+s.r.l.'` - **substring (1 argument)**: `/api/latest/Company/Search?$filter=substring(companyName,1)+eq+'do'` - **substring (2 arguments)**: `/api/latest/Company/Search?$filter=substring(companyName,1,2)+eq+'do'` - **substringof**: `/api/latest/Company/Search?$filter=substringof('srl',companyName)` - **tolower**: `/api/latest/Company/Search?$filter=tolower(companyName)+eq+'my+company+name'` - **toupper**: `/api/latest/Company/Search?$filter=toupper(companyName)+eq+'MY+COMPANY'` - **trim**: `/api/latest/Company/Search?$filter=trim(companyName,1)+eq+'my+company'` - **concat**: `/api/latest/Company/Search?$filter=concat(companyName,Code)+eq+'My+companyABC'` ``` -------------------------------- ### Combined OData Query Example Source: http://api.crmincloud.it Provides an example of a complex OData query combining multiple parameters: $filter, $top, $skip, and $orderby. ```HTTP GET: /api/{version}/Company/1/Activities?$filter=Subject%20eq'Appuntamento'&$top=10&$skip=5&$orderby=Description%20desc ``` -------------------------------- ### Perform Bearer Authentication Request Source: http://api.crmincloud.it Example of an HTTP GET request using a Bearer token in the Authorization header. ```http GET https://myhost.com/api/latest/Company/Get/1 HTTP/1.1 Host: myhost.com Connection: keep-alive Accept: application/json, text/plain, */* Origin: null User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) Authorization: Bearer my_jwt_token Accept-Encoding: gzip, deflate, br Accept-Language: en,en-US;q=0.9,it-IT;q=0.8,it;q=0.7 ``` -------------------------------- ### Pass API Key via Query String Source: http://api.crmincloud.it Example of passing an API key as a query parameter for a REST API request. ```http GET http://api.crmincloud.it/api/latest/lead/GetNewInstance?apikey=API_KEY ``` -------------------------------- ### Identify Calling Application Source: http://api.crmincloud.it Example of including the Crm-ApplicationName header in an authenticated request. ```http GET https://myhost.com/api/latest/Company/Get/1 HTTP/1.1 Host: myhost.com Connection: keep-alive Accept: application/json, text/plain, */* Origin: null User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) Authorization: Bearer my_jwt_token Accept-Encoding: gzip, deflate, br Accept-Language: en,en-US;q=0.9,it-IT;q=0.8,it;q=0.7 Crm-ApplicationName: MyApplication ``` -------------------------------- ### OData Top and Skip for Pagination Source: http://api.crmincloud.it Illustrates how to use $top and $skip OData parameters to implement pagination for result sets. These parameters control the number of items returned and the starting point of the results. ```HTTP GET: /api/{version}/{controller}/{id}/{SubItems}?$top=10 ``` ```HTTP GET: /api/{version}/Company/1/Contacts?$top=10 ``` ```HTTP GET: /api/{version}/{controller}/{id}/{SubItems}?$skip=10 ``` ```HTTP GET: /api/{version}/Company/1/Contacts?$skip=10 ``` ```HTTP GET: /api/{version}/{controller}/{id}/{SubItems}?$top=10&$skip=50 ``` ```HTTP GET: /api/{version}/Company/1/Contacts?$top=10&$skip=50 ``` -------------------------------- ### OData Select for Specific Fields Source: http://api.crmincloud.it Explains how to use the $select OData parameter to retrieve only specific fields from the results. This example selects 'id' and 'companyName'. ```HTTP GET: /api/{version}/{controller}/{id}/{SubItems}?$select=csv ``` ```HTTP GET: /api/{version}/Company/1/Contacts?$select=id,companyName ``` -------------------------------- ### OData Filter with Enum String Values Source: http://api.crmincloud.it Demonstrates how to filter using enum values in OData, which must be expressed as strings. This example filters opportunities by status. ```HTTP GET: /api/{version}/Company/1/Opportunities?$filter=status eq 'Suspended' ``` ```HTTP GET: /api/{version}/Opportunity/SearchIds?$filter=status eq 'Suspended' ``` -------------------------------- ### OData Filter for String Equality Source: http://api.crmincloud.it An example of using the $filter OData parameter to check for string equality, specifically filtering contacts by name. ```HTTP GET: /api/{version}/Company/1/Contacts?$filter=Name%20eq%20'Damiano' ``` -------------------------------- ### OData Filter for Specific Criteria Source: http://api.crmincloud.it Demonstrates the use of the $filter OData parameter to retrieve specific data based on criteria. This example shows filtering by CompanyId. ```HTTP GET: /api/{version}/{controller}/{id}/{SubItems}?$filter=criteria ``` ```HTTP GET: /api/{version}/Company/1/Contacts?$filter=CompanyId%20eq%201 ``` -------------------------------- ### OData Search IDs Source: http://api.crmincloud.it Retrieve IDs of Business Objects (BOs) based on specified OData criteria. Supports GET and POST requests. ```APIDOC ## GET /api/{version}/{controller}/SearchIds ### Description Retrieves the IDs of Business Objects (BOs) matching the specified OData criteria. ### Method GET ### Endpoint /api/{version}/{controller}/SearchIds ### Query Parameters - **$filter** (string) - Optional - Filter criteria. - **$orderby** (string) - Optional - Order criteria. - **$skip** (string) - Optional - Number of items to skip. - **$top** (string) - Optional - Maximum number of items to return. ### Request Example GET /api/latest/Company/SearchIds?$filter=id eq 1 or (id gt 3 and id lt 10)&$orderby=id asc&$skip=0&$top=100 ## POST /api/{version}/{controller}/SearchIds ### Description Retrieves the IDs of Business Objects (BOs) matching the specified OData criteria using a JSON payload. ### Method POST ### Endpoint /api/{version}/{controller}/SearchIds ### Request Body - **filter** (string) - Optional - Filter criteria. - **orderby** (string) - Optional - Order criteria. - **top** (string) - Optional - Maximum number of items to return. - **skip** (string) - Optional - Number of items to skip. - **select** (string) - Optional - Fields to select. ### Request Example ```json { "filter": "id eq 1 or (id gt 3 and id lt 10)", "orderby": "id asc", "top": "100", "skip": "0", "select": "id,companyName,billed" } ``` ### Response #### Success Response (200) - **ids** (array) - An array of IDs matching the criteria. ``` -------------------------------- ### OData Search BO/DTO Source: http://api.crmincloud.it Retrieve Business Objects (BOs) or Data Transfer Objects (DTOs) in JSON format based on specified OData criteria. Supports GET and POST requests. ```APIDOC ## GET /api/{version}/{controller}/Search ### Description Retrieves Business Objects (BOs) or Data Transfer Objects (DTOs) in JSON format matching the specified OData criteria. ### Method GET ### Endpoint /api/{version}/{controller}/Search ### Query Parameters - **$filter** (string) - Optional - Filter criteria. - **$orderby** (string) - Optional - Order criteria. - **$skip** (string) - Optional - Number of items to skip. - **$top** (string) - Optional - Maximum number of items to return. ### Request Example GET /api/latest/Company/Search?$filter=id eq 1 or (id gt 3 and id lt 10)&$orderby=id asc&$skip=0&$top=100 ## POST /api/{version}/{controller}/Search ### Description Retrieves Business Objects (BOs) or Data Transfer Objects (DTOs) in JSON format matching the specified OData criteria using a JSON payload. ### Method POST ### Endpoint /api/{version}/{controller}/Search ### Request Body - **filter** (string) - Optional - Filter criteria. - **orderby** (string) - Optional - Order criteria. - **top** (string) - Optional - Maximum number of items to return. - **skip** (string) - Optional - Number of items to skip. - **select** (string) - Optional - Fields to select. ### Request Example ```json { "filter": "id eq 1 or (id gt 3 and id lt 10)", "orderby": "id asc", "top": "100", "skip": "0", "select": "id,companyName,billed" } ``` ### Response #### Success Response (200) - **data** (array) - An array of BO/DTO objects matching the criteria. ``` -------------------------------- ### API Routing and Versioning Source: http://api.crmincloud.it Explains the standard URL structure and how to manage API versions. ```APIDOC ## API Routing Structure ### Endpoint Pattern {schema}://{host}/api/{version}/{controller}/{details}/{action}/{id}?{querystring} ### Path Tokens - **{version}**: API version (e.g., 'v1') or 'latest' alias. - **{controller}**: The service name to invoke. - **{details}**: Optional detail level for the returned JSON. - **{action}**: Optional method/action within the controller. - **{id}**: Optional single argument/parameter for the method. ``` -------------------------------- ### Global Configuration Options Source: http://api.crmincloud.it Details on how to customize JSON serialization using custom HTTP headers prefixed with 'Crm-'. ```APIDOC ## Global Formatting Options ### Headers - **Crm-TypeNameHandling**: Controls type name inclusion (None, Objects, RootOnly). - **Crm-NullValueHandling**: Controls NULL property serialization (Ignore, Include). - **Crm-NamingStrategy**: Sets property naming convention (AsIs, UpperCamelCase, LowerCamelCase, SnakeCase, KebabCase). - **Crm-Formatting**: Sets JSON indentation (None, Indented). - **Crm-WebApiRules**: CSV list of processing rules (e.g., LeadMustBeUniqueByEmail=true). ``` -------------------------------- ### API Emulation Option Source: http://api.crmincloud.it Configuration option to emulate the behavior of the previous version of the REST APIs (Tustena 17). ```APIDOC ### Emulation Options If it is necessary to emulate the behavior of the previous version of the REST APIs (Tustena 17), the following option can be used (though not recommended). * **Crm-EmulateWebApiVersion** * **Not specified:** No emulation is activated. * **v9:** Emulates the behavior of the previous generation REST APIs (Tustena 17). ``` -------------------------------- ### OData Query Parameters Diagnostics Source: http://api.crmincloud.it Test the OData parser by passing OData parameters via the querystring or POST body and receiving a JSON representation of these parameters. ```APIDOC ## GET /api/{version}/{controller}/GetODataQueryParameters ### Description Tests the OData parser by returning a JSON object representing the OData parameters passed in the query string or POST body. ### Method GET ### Endpoint /api/{version}/{controller}/GetODataQueryParameters ### Response #### Success Response (200) - **queryParameters** (object) - A JSON object detailing the parsed OData query parameters. ``` -------------------------------- ### OData Primitive Data Types and Enums Source: http://api.crmincloud.it Information on the primitive data types supported by the OData parser and how to handle enum values. ```APIDOC ## OData Primitive Data Types and Enums ### Description This section outlines the primitive data types supported by the OData parser and provides guidance on using enum values in queries. ### Supported Primitive Data Types: - Integer numbers - Non-integer numbers - Strings - Booleans - Date/time values Specifically, the following MS.NET types are supported: - `System.Byte` - `System.SByte` - `System.UInt16` - `System.Int16` - `System.UInt32` - `System.Int32` - `System.Int64` - `System.UInt64` - `System.Single` - `System.Double` - `System.Decimal` - `System.String` - `System.DateTime` (see specific paragraph for date/time handling) ### OData and Enum Fields: Enum types are supported by the OData parser. However, they must be expressed using their string representation, not their native numeric value. **Examples**: - `GET: /api/{version}/Company/1/Opportunities?$filter=status eq 'Suspended'` - `GET: /api/{version}/Opportunity/SearchIds?$filter=status eq 'Suspended'` ``` -------------------------------- ### OData OrderBy for Sorting Source: http://api.crmincloud.it Shows how to use the $orderby OData parameter to sort the results. The criteria can specify the field and the sort direction (e.g., 'Id desc'). ```HTTP GET: /api/{version}/{controller}/{id}/{SubItems}?$orderby=criteria ``` ```HTTP GET: /api/{version}/Company/1/Contacts?$orderby=Id%20desc ``` -------------------------------- ### String Manipulation with OData Filter Source: http://api.crmincloud.it Demonstrates various string manipulation functions available in OData filters, such as startswith, endswith, contains, length, indexof, replace, substring, substringof, tolower, toupper, trim, and concat. These functions allow for flexible data querying based on string properties. ```HTTP /api/latest/Company/Search?$filter=startswith(companyName,'ACME')+eq+10 ``` ```HTTP /api/latest/Company/Search?$filter=endswith(companyName,'srl')+eq+10 ``` ```HTTP /api/latest/Company/Search?$filter=contains(companyName,'srl') ``` ```HTTP /api/latest/Company/Search?$filter=length(companyName)+eq+10 ``` ```HTTP /api/latest/Company/Search?$filter=indexof(companyName,'S')+eq+7 ``` ```HTTP /api/latest/Company/Search?$filter= replace(companyName,'srl','s.r.l.')+eq+'acme+s.r.l.'&$top=10&$skip=0 ``` ```HTTP /api/latest/Company/Search?$filter=substring(companyName,1)+eq+'do' ``` ```HTTP /api/latest/Company/Search?$filter=substring(companyName,1,2)+eq+'do' ``` ```HTTP /api/latest/Company/Search?$filter=substringof('srl',companyName) ``` ```HTTP /api/latest/Company/Search?$filter=tolower(companyName)+eq+'my+company+name' ``` ```HTTP /api/latest/Company/Search?$filter=toupper(companyName)+eq+'MY+COMPANY' ``` ```HTTP /api/latest/Company/Search?$filter=trim(companyName,1)+eq+'my+company' ``` ```HTTP /api/latest/Company/Search?$filter=concat(companyName,Code)+eq+'My+companyABC' ``` -------------------------------- ### Polymorphic Serialization Styles Source: http://api.crmincloud.it Overview of supported polymorphic serialization styles and the data types they apply to. ```APIDOC ## Polymorphic Serialization Options ### Description This section details the polymorphic serialization options available, which allow for fine-grained customization of data representation. These options act at a granular level, offering more precise control than general formatting options. The prefix "Crm-" is omitted for brevity in the option names. **Note on Enums**: Properties of type enum are handled in a separate section. ### Supported Styles and Applications | Option Name | Supported Styles | Applied To | |---|---|---| | AnagraphicCompanyTypeIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - CarrierDTO.ContactTypeId
- CompanyDTO.ContactTypeId | | AnagraphicIndustryIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - CarrierDTO.CompanyTypeId
- CompanyDTO.CompanyTypeId
- LeadDTO.Industry | | AnagraphicSourceIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - CarrierDTO.Source
- CompanyDTO.Source
- ContactDTO.Source
- LeadDTO.Source | | BusinessRolesStyle | - AdaptiveCsv
- AdaptiveExternalReference
- AdaptiveName
- AdaptiveStringOnlyName
- Csv
- CsvOfIds
- CsvOfNames
- Id | - ContactDTO.BusinessRoles
- LeadDTO.BusinessRoles | | CommercialZoneStyle | - AdaptiveCode
- AdaptiveDescription
- AdaptiveExternalReference
- AdaptiveStringOnlyCode
- AdaptiveStringOnlyDescription
- Id | - CarrierDTO.CommercialZone
- CompanyDTO.CommercialZone
- ContactDTO.CommercialZone
- LeadDTO.CommercialZone | | CompanyCategoriesStyle | - AdaptiveCsv
- AdaptiveExternalReference
- AdaptiveName
- AdaptiveStringOnlyName
- CsvOfIds
- CsvOfNames
- Id | - CompanyDTO.Categories | | CompanyIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.CompanyId
- ContactDTO.CompanyId | | ContactCategoriesStyle | - AdaptiveCsv
- AdaptiveExternalReference
- AdaptiveName
- AdaptiveStringOnlyName
- CsvOfIds
- CsvOfNames
- Id | - ContactDTO.Categories | | ContactIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.ContactId | | EmailStyle | - Compact
- Csv
- FlattenedExpansion
- Full
- Tiny
- ValueOnly | - AddressDTO.NormalizeEMail
- CarrierDTO.NormalizeEMail
- CompanyDTO.NormalizeEMail
- ContactDTO.NormalizeEMail
- LeadDTO.NormalizeEMail | | FreeFieldsStyle | - AsValueOnlyParentProperties
- Full | - AccountDTO.FreeFields
- ActivityDTO.FreeFields
- AddressDTO.FreeFields
- CarrierDTO.FreeFields
- CatalogDTO.FreeFields
- CatalogMovementsDTO.FreeFields
- CatalogProductPriceDTO.FreeFields
- CompanyDTO.FreeFields
- ContactDTO.FreeFields
- ContractDTO.FreeFields
- ContractTypeOfServiceDTO.FreeFields
- CustomErpDocumentDTO.FreeFields
- DDTDTO.FreeFields
- ERPRowDTO.FreeFields
- EventDTO.FreeFields
- EventItemDTO.FreeFields
- ExtensionsPlaygroundDTO.FreeFields
- FileDossierDTO.FreeFields
- InvoiceDTO.FreeFields
- JobOrderDTO.FreeFields
- JobOrderTaskDTO.FreeFields
- JobOrderTaskSparePartDTO.FreeFields
- LeadDTO.FreeFields
- OpportunityDTO.FreeFields
- OrderDTO.FreeFields
- PromotionDTO.FreeFields
- QuoteDTO.FreeFields
- StorageDTO.FreeFields
- TicketDTO.FreeFields | | GeoLocalizationStyle | - Full
- GeoJSON | - AddressDTO.GeoLocalization
- AppointmentDTO.GeoLocalization
- CarrierDTO.GeoLocalization
- CompanyDTO.GeoLocalization
- ContactDTO.GeoLocalization
- LeadDTO.GeoLocalization
- OpportunityDTO.GeoLocalization
- PromotionDTO.GeoLocalization | | ImplicitConsentStyle | - Compact
- Full | - ActivityDTO.ImplicitConsent | | LeadCategoriesStyle | - AdaptiveCsv
- AdaptiveExternalReference
- AdaptiveName
- AdaptiveStringOnlyName
- CsvOfIds
- CsvOfNames
- Id | - LeadDTO.Categories | | LeadIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.LeadId | | LeadPriorityIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - LeadDTO.Priority | | LeadProductInterestIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - LeadDTO.ProductInterest | | LeadRatingIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - LeadDTO.Rating | | LeadStatusIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - LeadDTO.Status | | OpportunityCategoryStyle | - AdaptiveCsv
- AdaptiveExternalReference
- AdaptiveName
- AdaptiveStringOnlyName
- CsvOfIds
- CsvOfNames
- Id | - OpportunityDTO.Categories | | OpportunityIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.OpportunityId | | OpportunityStageIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - OpportunityDTO.Stage | | OpportunityStatusIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - OpportunityDTO.Status | | OwnerIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.OwnerId
- AppointmentDTO.OwnerId
- CarrierDTO.OwnerId
- CompanyDTO.OwnerId
- ContactDTO.OwnerId
- LeadDTO.OwnerId
- OpportunityDTO.OwnerId
- PromotionDTO.OwnerId
- TicketDTO.OwnerId | | PhoneStyle | - Compact
- Csv
- FlattenedExpansion
- Full
- Tiny
- ValueOnly | - AddressDTO.NormalizePhone
- CarrierDTO.NormalizePhone
- CompanyDTO.NormalizePhone
- ContactDTO.NormalizePhone
- LeadDTO.NormalizePhone | | PriceListIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - CompanyDTO.PriceListId
- ContactDTO.PriceListId
- LeadDTO.PriceListId | | ProductCategoriesStyle | - AdaptiveCsv
- AdaptiveExternalReference
- AdaptiveName
- AdaptiveStringOnlyName
- CsvOfIds
- CsvOfNames
- Id | - ProductDTO.Categories | | ProductIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.ProductId
- CatalogDTO.ProductId
- CatalogMovementsDTO.ProductId
- CatalogProductPriceDTO.ProductId
- CustomErpDocumentDTO.ProductId
- DDTDTO.ProductId
- ERPRowDTO.ProductId
- EventItemDTO.ProductId
- InvoiceDTO.ProductId
- JobOrderDTO.ProductId
- JobOrderTaskDTO.ProductId
- JobOrderTaskSparePartDTO.ProductId
- LeadDTO.ProductId
- OpportunityDTO.ProductId
- OrderDTO.ProductId
- PromotionDTO.ProductId
- QuoteDTO.ProductId
- TicketDTO.ProductId | | ProductInterestStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - LeadDTO.ProductInterest | | ProductPriceStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - CatalogDTO.ProductPrice
- CatalogMovementsDTO.ProductPrice
- CatalogProductPriceDTO.ProductPrice
- CustomErpDocumentDTO.ProductPrice
- DDTDTO.ProductPrice
- ERPRowDTO.ProductPrice
- EventItemDTO.ProductPrice
- InvoiceDTO.ProductPrice
- JobOrderDTO.ProductPrice
- JobOrderTaskDTO.ProductPrice
- JobOrderTaskSparePartDTO.ProductPrice
- LeadDTO.ProductPrice
- OpportunityDTO.ProductPrice
- OrderDTO.ProductPrice
- PromotionDTO.ProductPrice
- QuoteDTO.ProductPrice | | ProductTypeIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ProductDTO.TypeId | | SalesPersonIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.SalesPersonId
- AppointmentDTO.SalesPersonId
- CarrierDTO.SalesPersonId
- CompanyDTO.SalesPersonId
- ContactDTO.SalesPersonId
- LeadDTO.SalesPersonId
- OpportunityDTO.SalesPersonId
- PromotionDTO.SalesPersonId
- TicketDTO.SalesPersonId | | SourceIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.SourceId
- AppointmentDTO.SourceId
- CarrierDTO.SourceId
- CompanyDTO.SourceId
- ContactDTO.SourceId
- LeadDTO.SourceId
- OpportunityDTO.SourceId
- PromotionDTO.SourceId
- TicketDTO.SourceId | | StateIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - AddressDTO.StateId
- CompanyDTO.StateId
- ContactDTO.StateId
- LeadDTO.StateId | | StatusIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.StatusId
- AppointmentDTO.StatusId
- CarrierDTO.StatusId
- CompanyDTO.StatusId
- ContactDTO.StatusId
- LeadDTO.StatusId
- OpportunityDTO.StatusId
- PromotionDTO.StatusId
- TicketDTO.StatusId | | StringStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.Description
- AppointmentDTO.Description
- CarrierDTO.Description
- CompanyDTO.Description
- ContactDTO.Description
- LeadDTO.Description
- OpportunityDTO.Description
- PromotionDTO.Description
- TicketDTO.Description | | TaxRegimeIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - CompanyDTO.TaxRegimeId
- ContactDTO.TaxRegimeId
- LeadDTO.TaxRegimeId | | TicketCategoriesStyle | - AdaptiveCsv
- AdaptiveExternalReference
- AdaptiveName
- AdaptiveStringOnlyName
- CsvOfIds
- CsvOfNames
- Id | - TicketDTO.Categories | | TicketIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.TicketId | | TimeZoneStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - AddressDTO.TimeZoneId
- CompanyDTO.TimeZoneId
- ContactDTO.TimeZoneId
- LeadDTO.TimeZoneId | | UserIdStyle | - AdaptiveDescription
- AdaptiveStringOnlyDescription
- Description
- FlattenedExpansion
- Id | - ActivityDTO.UserId
- AppointmentDTO.UserId
- CarrierDTO.UserId
- CompanyDTO.UserId
- ContactDTO.UserId
- LeadDTO.UserId
- OpportunityDTO.UserId
- PromotionDTO.UserId
- TicketDTO.UserId | ``` -------------------------------- ### OData Query Options for Related Elements Source: http://api.crmincloud.it Details on how to use OData query options like $top, $skip, $orderby, $filter, and $select when accessing related or child elements. ```APIDOC ## OData Query Options for Related Elements ### Description This section explains how to use OData query parameters to retrieve and manipulate related or child elements within the API. The Web API supports OData parameters when they are specified in the URLs of requests for related/child elements. ### Supported OData Parameters: - **Top**: Limits the number of items returned. - **Skip**: Skips a specified number of items. - **OrderBy**: Sorts the results based on specified criteria. - **Filter**: Filters the results based on specified criteria. - **Select**: Specifies which properties to include in the response. ### Template URLs and Examples: #### Top - **Template URL**: `GET: /api/{version}/{controller}/{id}/{SubItems}?$top=10` - **Example**: `GET: /api/{version}/Company/1/Contacts?$top=10` #### Skip - **Template URL**: `GET: /api/{version}/{controller}/{id}/{SubItems}?$skip=10` - **Example**: `GET: /api/{version}/Company/1/Contacts?$skip=10` #### Pagination (Top and Skip) - **Template URL**: `GET: /api/{version}/{controller}/{id}/{SubItems}?$top=10&$skip=50` - **Example**: `GET: /api/{version}/Company/1/Contacts?$top=10&$skip=50` #### OrderBy - **Template URL**: `GET: /api/{version}/{controller}/{id}/{SubItems}?$orderby=criteria` - **Example**: `GET: /api/{version}/Company/1/Contacts?$orderby=Id%20desc` #### Filter - **Template URL**: `GET: /api/{version}/{controller}/{id}/{SubItems}?$filter=criteria` - **Example**: `GET: /api/{version}/Company/1/Contacts?$filter=CompanyId%20eq%201` #### Select - **Template URL**: `GET: /api/{version}/{controller}/{id}/{SubItems}?$select=csv` - **Example**: `GET: /api/{version}/Company/1/Contacts?$select=id,companyName` ### Additional Examples: - `GET: /api/{version}/Company/1/Activities?$filter=Subject%20eq'Appuntamento'&$top=10&$skip=5&$orderby=Description%20desc` - `GET: /api/{version}/Company/1/Contacts?$filter=Name%20eq%20'Damiano'` ``` -------------------------------- ### OData v3 Date/Time Formats Source: http://api.crmincloud.it Use the 'datetime' keyword followed by the ISO 8601 formatted string for OData v3 date/time queries. Supports up to 7 decimal places for seconds. ```odata $filter=myDateTimeField eq datetime'2015-07-28T10:23:00Z' ``` ```odata $filter=myDateTimeField eq datetime'2015-07-28T10:23:00.1Z' ``` ```odata $filter=myDateTimeField gt datetime'2015-07-28T10:23:00.12Z' ``` ```odata $filter=myDateTimeField lt datetime'2015-07-28T10:23:00.123Z' ``` ```odata $filter=myDateTimeField eq datetime'2015-07-28T10:23:00.1234Z' ``` ```odata $filter=myDateTimeField gt datetime'2015-07-28T10:23:00.12345Z' ``` ```odata $filter=myDateTimeField eq datetime'2015-07-28T10:23:00.123456Z' ``` ```odata $filter=myDateTimeField lt datetime'2015-07-28T10:23:00.1234567Z' ``` -------------------------------- ### Using Free Fields in OData $select Source: http://api.crmincloud.it To include custom Free Fields in OData $select queries, prefix their names with 'FF_'. This distinguishes them from standard fields. ```http GET: /api/{version}/Company/Search?$select=id,companyName,FF_MyCustomFreeField1,FF_AnotherFreeField ``` -------------------------------- ### OData v4 Date/Time Formats Source: http://api.crmincloud.it OData v4 simplifies date/time formatting by omitting the 'datetime' keyword. Use ISO 8601 format with optional fractional seconds. ```odata $filter=myDateTimeField eq 2015-07-28T10:23:00Z ``` ```odata $filter=myDateTimeField eq 2015-07-28T10:23:00.1Z ``` ```odata $filter=myDateTimeField gt 2015-07-28T10:23:00.12Z ``` ```odata $filter=myDateTimeField lt 2015-07-28T10:23:00.123Z ``` ```odata $filter=myDateTimeField eq 2015-07-28T10:23:00.1234Z ``` ```odata $filter=myDateTimeField gt 2015-07-28T10:23:00.12345Z ``` ```odata $filter=myDateTimeField eq 2015-07-28T10:23:00.123456Z ``` ```odata $filter=myDateTimeField lt 2015-07-28T10:23:00.1234567Z ``` -------------------------------- ### Error Handling Source: http://api.crmincloud.it Standard HTTP status codes returned by the API. ```APIDOC ## Error Status Codes - **400**: Bad Request (malformed query). - **401**: Unauthorized (authentication error). - **403**: Forbidden (insufficient permissions). - **404**: Not Found (resource unknown). - **409**: Conflict (resource state conflict). - **500**: Internal Server Error. ``` -------------------------------- ### Login Request Payload Source: http://api.crmincloud.it Send this JSON payload to the /Auth/Login endpoint to obtain a JWT authentication token. Ensure username and password fields are correctly populated. ```json { "grant_type": "password", "username": "admin@admin.com", "password": "admin" } ``` -------------------------------- ### OData Search Criteria for IDs (POST) Source: http://api.crmincloud.it Use POST to specify OData search criteria for retrieving IDs via a JSON payload, which is useful for avoiding URL escaping issues. ```json { "filter": "id eq 1 or (id gt 3 and id lt 10)", "orderby": "id asc", "top": "100", "skip": "0", "select": "id,companyName,billed" } ``` -------------------------------- ### OData $filter Operators Source: http://api.crmincloud.it Details the logical and arithmetic operators, as well as canonical functions supported within the OData $filter expressions. ```APIDOC ### $filter – Logical Operators Expressions in the **$filter** parameter support the following logical operators: * **eq** -> Equal * **ne** -> Not Equal * **gt** -> Greater Than * **ge** -> Greater Than or Equal * **lt** -> Less Than * **le** -> Less Than or Equal * **and** -> Logical And * **or** -> Logical Or For more details, refer to the respective OData v3 specifications. ### $filter – Arithmetic Operators Expressions in the **$filter** parameter support the following arithmetic operators: * **add** -> addition * **sub** -> subtraction * **mul** -> multiplication * **div** -> division * **mod** -> modulo For more details, refer to the respective OData v3 specifications. #### Examples * **add** -> /api/latest/Company/Search?$filter=Billed+add+5+eq+15 * **sub** -> /api/latest/Company/Search?$filter=Billed+sub+5+eq+25 * **mul** -> /api/latest/Company/Search?$filter=Billed+mul+5+eq+100 * **div** -> /api/latest/Company/Search?$filter=Billed+div+5+eq+5 * **mod** -> /api/latest/Company/Search?$filter=Billed+mod+5+eq+0 ### $filter – Canonical Functions Expressions in the **$filter** parameter support the following canonical functions: * **startswith** * **endswith** * **length** * **indexof** * **replace** * **substring** * **substringof** * **tolower** * **toupper** * **trim** * **concat** For more details, refer to the respective OData v3 specifications. ``` -------------------------------- ### JWT Token Response Source: http://api.crmincloud.it The response from the /Auth/Login endpoint contains the JWT token and its expiration time. The 'access_token' should be used in subsequent API calls with 'Bearer' authentication. ```json { "access_token": "my_jwt_token", "expires_in": 1200, "refresh_token": "5fc87399-413d-44de-8976-dc3d15e4b0bc", "result": 0, "token_type": "bearer" } ``` -------------------------------- ### Incorrect OData Date/Time Formats Source: http://api.crmincloud.it Avoid using quotes around the date/time string or the 'cast' function in OData queries, as these are not supported for date/time literals. ```odata $filter=myDateTimeField eq '2015-07-28T10:23:00.1Z' ``` ```odata $filter=myDateTimeField eq cast(2015-07-28T10:23:00Z) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.