Collections

List collections

GET /recs/{client}/collections
List all available collections.
RETURN TYPE
RESPONSES
200 OK
400 Bad Request. Most probably the data provided in the request is invalid.
401 The user is not allowed to perform this operation.
403 Access to this resource is forbidden.
404 The referenced resource was not found.
PARAMETERS
offset (optional) Query Parameter — integer
limit (optional) Query Parameter — integer

Sample code

curl -X GET -H "Accept: application/vnd.adobe.target.v1+json" -H "X-Target-user-email: buzz@adobe.com" https://{recs-host}/api/recs/demo/collections?offset=1&limit=6

{
   "offset": 1,
   "limit": 6,
   "total": 12,
   "list": [
     {"id":1,"name":"Male Sport"},
     {"id":6,"name":"Female Sport"},
     {"id":8,"name":"Other Collection"}
     ....
   ]
 }

Create a collection

POST /recs/{client}/collections
Create a new collection as specified by the contents of the request and return the newly-created collection definition.
REQUEST BODY
collection (required) Body Parameter — Collection
RESPONSES
201 Created
400 There was an error creating the collection. Most probably invalid data was provided by the user.
401 The user is not allowed to perform this operation.
403 Access to this resource is forbidden.
404 The referenced resource was not found.

Sample code

curl -X POST -H "Accept: application/vnd.adobe.target.v1+json" -H "Content-Type: application/vnd.adobe.target.v1+json" -H "X-Target-user-email: buzz@adobe.com" https://{recs-host}/api/recs/demo/collections

{
 "name":"Collection X",
 "rules":[
   {"category": {"contains":["x", "X"]}}
  ]
}

<-- Location https://{recs-host}/api/recs/demo/collections/2

{
 "id" : 9
 "name":"Collection X",
 "rules":[
   {"category": {"contains":["x", "X"]}}
  ]
}

Get a collection by id

GET /recs/{client}/collections/{id}
Get the collection definition, specified by the provided id.
RETURN TYPE
RESPONSES
200 OK
400 Bad Request. Most probably the data provided in the request is invalid.
401 The user is not allowed to perform this operation.
403 Access to this resource is forbidden.
404 The referenced resource was not found.
PARAMETERS
id (required) Path Parameter — integer

Sample code

curl -X GET -H "Accept: application/vnd.adobe.target.v1+json" -H "X-Target-user-email: buzz@adobe.com" https://{recs-host}/api/recs/demo/collections/1

{
 "id": 9
 "name": "Male Sport",
 "rules":[
   {"category": {"contains":["male sport"]}}
  ]
}

Update a collection by id

PUT /recs/{client}/collections/{id}
Update a collection with the new rules specified by the request data.
REQUEST BODY
collection (required) Body Parameter — Collection
RETURN TYPE
RESPONSES
200 OK
201 Created
400 Bad Request. Most probably the data provided in the request is invalid.
401 The user is not allowed to perform this operation.
403 Access to this resource is forbidden.
404 The referenced resource was not found.
PARAMETERS
id (required) Path Parameter — integer

Sample code

curl -X PUT -H "Accept: application/vnd.adobe.target.v1+json" -H "Content-Type: application/vnd.adobe.target.v1+json" -H "X-Target-user-email: buzz@adobe.com" https://{recs-host}/api/recs/demo/collections/9

{
 "name":"Collection Y",
 "rules":[
   {"category": {"contains":["y", "Y"]}}
  ]
}

{
 "id" : 9
 "name":"Collection Y",
 "rules":[
   {"category": {"contains":["y", "Y"]}}
  ]
}

Delete a collection

DELETE /recs/{client}/collections/{id}
Delete the collection referenced by the specified id.
RETURN TYPE
RESPONSES
200 OK
400 Bad Request. Most probably the data provided in the request is invalid.
401 The user is not allowed to perform this operation.
204 No Content
403 Access to this resource is forbidden.
404 The referenced resource was not found.
PARAMETERS
id (required) Path Parameter — integer

Sample code

curl -X DELETE -H "Accept: application/vnd.adobe.target.v1+json" -H "Content-Type: application/vnd.adobe.target.v1+json" -H "X-Target-user-email: buzz@adobe.com" https://{recs-host}/api/recs/demo/collections/9

{
 "name":"Collection Y",
 "rules":[
   {"category": {"contains":["y", "Y"]}}
  ]
}

{
 "id" : 9
 "name":"Collection Y",
 "rules":[
   {"category": {"contains":["y", "Y"]}}
  ]
}

Field Descriptions and Validation Rules

Field Path Description Validation
id Read only long value, generated by server side at the time of creation. Used to identify a collection in URL. Must not exist on POST. Optional on PUT but must be the same as the existing id if included.
name String. Must be unique, 250 characters or less and not empty.
rule->AttributeName String. Plus a set of predefined attributes: id,category,name,message,environment,inventory,margin,value,pageUrl, thumbnailUrl. Must be 100 characters or less and not empty.
rule->AttributeName->Operation

Enum represents the matching operations to be applied on products, allowed values:

equals|notEquals|contains|doesNotContain|greaterOrEquals|lesserOrEquals|startsWith|endsWith

numeric operators: greaterOrEquals|lesserOrEquals

non numeric: startsWith|endsWith|contains|doesNotContain

numeric and non numeric: (equals|notEquals|valueIsPresent|valueIsNotPresent)

numeric = floating point value, negative accepted, scientific notations accepted

Must be a valid operation (as per description). Numeric attributes:environment,inventory,margin,value require numeric operations. e.g. greaterOrEquals|lesserOrEquals|equals|notEquals.

Must not include a value when using valueIsPresent or valueIsNotPresent.

rules List of rules. There must be at least 1 rule and no more than a 1000 rules.
rules->Operation->[] Comma separated list of values. Must be at least 1 value and no more than a 1000. Values cannot be empty or exceed 250 characters. Numeric attributes require numeric values. Numeric operations require numeric values.