Read an Object Instance
With this method, you can get a single object instance for the object type.
Request
URI: /ObjectType/v2/<FullyQualifiedObjectTypeIDWithUnderscores>('<ObjectInstanceID>')
Operation Type: CRUD
HTTP Method:GET
Permissions: <cdinstance>.r
Request Parameters
| Parameter | Required | Data Type | Description |
|---|---|---|---|
| ObjectInstanceID | Yes | String | Unique identifier which was auto-generated/specified while creating the object type instance |
Request Header
|
Name |
Required |
Data Type |
Description |
|---|---|---|---|
|
Accept-Language |
Optional |
string |
Accepted language header.
|
Request Example
/ObjectType/v2/iotae_devtest1_aejob_automobilestes:Material('Material1')Response
Format: ATOM/JSON
Response Status and Error Codes
| Code | Description |
|---|---|
| 200 | OK for Success |
Response Payload Example
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="http://localhost:9080/customdata-services/ObjectType/v2/">
<id>http://localhost:9080/customdata-services/ObjectType/v2/iotae_devtest1_aejob_automobilestes%3AMaterial('Material1')</id>
<title type="text">iotae_devtest1_aejob_automobilestes:Material</title>
<updated>2019-01-07T11:46:11.05+05:30</updated>
<category term="com.sap.appiot.iotae_devtest1_aejob_automobilestes:Material" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"></category>
<link href="iotae_devtest1_aejob_automobilestes%3AMaterial('Material1')" rel="edit" title="iotae_devtest1_aejob_automobilestes:Material"></link>
<content type="application/xml">
<m:properties>
<d:ObjectID>Material1</d:ObjectID>
<d:Density>{\"EN\":\"300\"}</d:Density>
<d:State>{\"EN\":\"null\"}</d:State>
</m:properties>
</content>
</entry>[response example]
Date Format Difference between v1 and v2 API
If there are Date, DateTime or Timestamp data type properties in the response, you will get different formats of these properties when calling v1 and v2 version of Read an Object Instance and Read all Object Instances API with $format=json. For $format=atom, both versions of API will return the yyyy-mm-ddThh:mm:ssZ format.
| API Version | Date Format | Example |
|---|---|---|
| v1 | “\/Date(<ticks>)\/”<ticks> = number of milliseconds since midnight Jan 1, 1970 | “\/Date(1633682658000)\/” |
| v2 | yyyy-mm-ddThh:mm:ssZ | 2021-10-08T08:44:18Z |
Example of calling v1 API
Request
URI: /ObjectType/v1/stg_edgestk_sh_smartsensing:A_SalesOrderItemType_0133?$format=json&$inlinecount=allpages
HTTP Method: GET
Response
Example of calling v2 API
Request
URI: /ObjectType/v2/stg_edgestk_sh_smartsensing:A_SalesOrderItemType_0133?$format=json&$inlinecount=allpages
HTTP Method: GET
Response