Create or Update a Resource

Creates or updates resources via upsert into your resources collection. If the resource does not already exist, it will be created. If it already exists, it will overwrite all fields specified in the request.

Resource Schema

The following fields may be sent in the body of the request to create or update the resource specified in the route:

Resource FieldTypeDescription
resource_type (required)StringA string designation of the resource type, e.g. article, product, recipe, video.
titleStringA human-readable title for this resource.
urlURLA URL indicating the location on the web for this resource.
thumbnailURLA URL to an image of or for this resource.
bodyStringA body of text for this resource. For articles and similar long-form content, the full body of the article should be here.
descriptionStringA short text description of this resource, often used in the display/rendering of the resource.
published_atISO-8601 TimestampThe publication date of this resource.
modified_atISO-8601 TimestampThe last modification date of this resource.
is_blacklistedBooleantrue to exclude from all content recommendations. false or un-set if not.
propsMap <String, String>A dictionary of additional metadata about this resource.
variantsMap <String, Object>A dictionary of variants of this resource. Variants are keyed by a unique identifier, and their value contains a dictionary of values that map to known resource fields

Creating a Resource

Create a resource with a given resource_id by specifying one or more fields as referenced in the Resource Schema above in the body of the request. If no resource with the specified resource_id exists, one will be created.

Note that the request will fail if any of the standard resource fields listed in the Resource Schema above are not of the correct type.

Updating an Existing Resource

If a resource with the specified resource_id does exist, we will update the existing resource.

Any fields specified in the body of the request will be updated with the new values specified. If a field is not in the body of the request, it will remain unchanged.

Note that the request will fail if any of the standard resource fields listed in the Resource Schema above are not of the correct type.

Managing Variants of a Resource

Variants of a given resource are managed by specifying a "variants" object in the request with any number of variants in it. Only variants that are included in this object will be augmented; variants not specified in the body of the request will remain unchanged.

Variants should only contain fields that are compatible with your existing resource fields (see Get Resource Fields for more details). That is, any variant's fields MUST match an existing field. Variants are not required to have any specific fields.

Specifying the same variant key more than once in the same PUT request will result in the last object specified with that variant being the value set. That means a put with data:

{
    resource_type: "product", 
    variants: {
      "1234a": {color: "Red", size_1: 32, size_2: 30},
      "1234a": {color: "Blue"}
    }
}

would result in variant 1234a having one property, color: Blue.

Setting a variant's value to the empty object, {}, will delete that variant.

Language
Authentication
Header
Click Try It! to start a request and see the response here!