CustomObjects Resource (Shop API 16.1)

Summary

Http Method Resource Description
GET /Custom_objects/{Object_type}/{Key} Reads a custom object with a given object type ID and a value for the key attribute of the object which represents its unique identifier.

Read Custom Object

Reads a custom object with a given object type ID and a value for the key attribute of the object which represents its unique identifier.

Url

GET http://hostname:port/dw/shop/v16_1/custom_objects/{object_type}/{key}

Formats

json, xml

Authentication

Name Description
None No authentication.

Response Document

CustomObject

Path Parameters

Parameter Type Description Constraints
key String the key attribute value of the custom object minLength=1, nullable=false
object_type String the ID of the object type minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 MalformedKeyParameterException

value (String)

parameter (String)

If the object key must be an integer, but the path parameter has an invalid format
404 ObjectTypeNotFoundException

objectType (String)

For an unknown object type ID
404 CustomObjectNotFoundException

key (String)

objectType (String)

If the custom object cannot be found

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.shop.custom_object.afterGET

afterGET (doc : Document) : Status

The function is called after the request has been processed.

Parameters:
doc - the document
Returns:
  • Status.OK for success.
  • Status.ERROR in case something went wrong.

Sample

REQUEST:
GET /dw/shop/v16_1/custom_objects/my_object_type/key_0815 HTTP/1.1
Host: sitegenesis.com
Accept: application/json

# in case of success:

RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Cache-Control: max-age=900,must-revalidate
{
  "_v" : "16.1",
   "_type" : "custom_object",
   "object_type":"my_object_type",
   "key_property":"key_attribute",
   "c_boolean":true,
   "c_date":"2015-02-03T00:00:00.000Z",
   "c_email":"[email protected]",
   "c_integer":42,
   "c_number":42.0,
   "c_string":"some text"
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"16.1",
   "_type":"fault",
  "fault":
  {
    "type":"NotFoundException",
    "message":"No custom object with key 'key_0815' found for object type 'my_object_type'."
  }
}
OCAPI obsolete versions 13.x and 14.x will be end of life in 2020 and versions 15.x and 16.x in 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.