CustomObjects resource (Shop API 23.2)

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/v23_2/custom_objects/{object_type}/{key}

Formats

json, xml

Authentication

Name Description
JWT Authentication via Customer JWT.
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.beforeGET

beforeGET (objectType : String , key : String ) : Status

The function is called before the request will be processed.

Parameters:
objectType - the ID of the object type
key - the key attribute value of the custom object
Returns:
a non-null Status ends the hook execution
dw.ocapi.shop.custom_object.modifyGETResponse

modifyGETResponse (scriptCustomObject : CustomObject , doc : CustomObject ) : Status

The function is called after the request has been processed.

Parameters:
scriptCustomObject - an instance of dw.object.CustomObject
doc - the document
Returns:
a non-null Status ends the hook execution

Sample

REQUEST:
GET /dw/shop/v23_2/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" : "23.2",
   "_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" : "23.2",
   "_type":"fault",
  "fault":
  {
    "type":"NotFoundException",
    "message":"No custom object with key 'key_0815' was found for object type 'my_object_type'."
  }
}
X OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.