OData service: Difference between revisions

Jump to navigation Jump to search
Line 55: Line 55:
     },
     },
...
...
</syntaxhighlight>
== Data request ==
Request for entity data. The resulting dataset depends on the query applied. Without a query, a single page of entity record results is returned. Default (and max) page size is 1000.
=== URI ===
* <code>https://[baseURI]/odata/v4/[organization]/[EntityName]</code>
* <code>https://[organization].[baseURI]/odata/v4/[EntityName]</code>
=== Queries ===
To see how the queries can be constructed, check the [https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html OData protocol].
The service is compliant to [https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_OData40MinimalConformanceLevel OData 4.0 Minimal Conformance Level] and partially to [https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_OData40IntermediateConformanceLevel OData 4.0 Intermediate Conformance Level].
To see a list of unsupported stuff, check [[#Limitations|Limitations]].
=== Paging ===
The data can be paged using <code>$top</code> and <code>$skip</code> query options. Except for that, also server-side paging is applied with a max page size of 1000 items. Whenever the server cuts the response to fulfill server limits, the response contains an [@odata.nextLink](http://docs.oasis-open.org/odata/odata-json-format/v4.0/cs01/odata-json-format-v4.0-cs01.html#_Toc365464689) annotation with a URI that can be used to retrieve the next page of data.
=== Example ===
Request: <nowiki> https://inspections.resco.net/odata/v4/[organization]/[entity] </nowiki>
Response (shortened):
<syntaxhighlight lang="json">{
  "@odata.context": "https://inspections.resco.net/odata/v4/[organization]/$metadata#account",
  "value": [
    {
      "@odata.etag": "W/\"7511A7BAE6FBAB8FF6E67C8DE78EB3CE\"",
      "address1_city": "Suffolk County",
      "address1_country": "USA",
      "address1_latitude": 42.423449,
      "address1_line1": "Charger Street",
      "address1_line2": "124",
      "address1_line3": null,
      "address1_longitude": -71.013693,
      "address1_postalcode": "02151",
      "address1_stateorprovince": "Massachusetts",
      "__createdby_id": null,
      "createdon": "2019-06-18T12:49:34.0000000Z",
      "customertypecode": null,
      "__defaultpricelevelid_id": null,
      "donotemail": false,
      "emailaddress1": "someone@example.com",
      "fax": null,
      "fs_portalpassword": null,
      "id": "585ace18-4eec-4288-9294-1286d768c210",
      "__modifiedby_id": null,
      "modifiedon": "2019-06-18T12:49:34.0000000Z",
      "name": "Warner Apartment Building",
      "__originatingleadid_id": null,
      "__ownerid_id": "601d9d17-89b4-e111-9c9a-00155d0b710a",
      "__owningbusinessunit_id": null,
      "__parentaccountid_id": null,
      "__primarycontactid_id": null,
      "revenue": 8630000,
      "revenue_base": 8630000,
      "statecode": 0,
      "statuscode": 1,
      "telephone1": "738-1946",
      "__transactioncurrencyid_id": "af05b07e-89b4-e111-9c9a-00155d0b710a",
      "vatid": null,
      "versionnumber": 2054,
      "websiteurl": "http://www.example28.com"
    },
</syntaxhighlight>
</syntaxhighlight>


Navigation menu