CustomObjectsSearch resource (Data API 19.10)

Summary

Http Method Resource Description
POST /custom_objects_search/{object_type}

Search resource for custom objects in scope of a specific custom object type.

The custom object search document contains a search object that allows filtering on various attributes.

The query attribute specifies a complex query that can be used to narrow down the search. These are the list of searchable attributes:

  • key_value_string - String
  • key_value_integer - Integer
  • creation_date - Date
  • last_modified - Date
  • site_id - String
  • any custom attribute

Note that only searchable attributes can be used in sorting.

Search custom objects

Search resource for custom objects in scope of a specific custom object type.

The custom object search document contains a search object that allows filtering on various attributes.

The query attribute specifies a complex query that can be used to narrow down the search. These are the list of searchable attributes:

Note that only searchable attributes can be used in sorting.

Url

POST https://hostname:port/dw/data/v19_10/custom_objects_search/{object_type}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

SearchRequest

Response Document

CustomObjectSearchResult

Path Parameters

Parameter Type Description Constraints
object_type String ID of the object type to search objects for minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 TypeMissmatchException

field (String)

Indicates that the value to search with does not match the type of the search field.
404 ObjectTypeNotFoundException

objectType (String)

In case of an unknown object type.

Sample

REQUEST:
POST /s/-/dw/data/v19_10/custom_objects_search/my_object_type HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8
{
    "count" : 1,
    "query" : {
      "bool_query":{
        "must":[
          { "term_query": { "fields": ["site_id"], "operator": "is", "values": ["SiteGenesis"] } },
          { "term_query": { "fields": ["c_number"], "operator": "is", "values": [42.0] } }
        ]
      }
    },
    "select" : "(**)",
    "start" : 2
}

# in case of success:

RESPONSE:
HTTP/1.1 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
  "_v" : "19.10",
  "_type" : "custom_object_search_result",
  "count" : 1,
  "hits" : [
    {
      "_type" : "custom_object",
      "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5"
      "object_type":"my_object_type",
      "key_property":"key_attribute",
      "key_value_integer" : 1,
      "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"
    }
  ],
  "query":{
    "bool_query" :{
      "_type" : "bool_query",
      "must":[
        { "term_query": { "fields": ["site_id"], "operator": "is", "values": ["SiteGenesis"] } },
        { "term_query": { "fields": ["c_number"], "operator": "is", "values": [42.0] } }
      ]
    }
  },
  "select" : "(**)",
  "start" : 2,
  "total" : 4
}

# 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":"19.10",
  "fault":
  {
    "type":"ObjectTypeNotFoundException",
    "message":"No object type with ID 'my_object_type' was found."
  }
}