Version 5 only.

Resource Representation

Example:
{
  "id": 1,
  "code": "Npc Entity 1",
  "name": "Npc Entity 1"
}

Supported Formats

json

GET /api/v2/npc_entities DEPRECATED
List npc entities

Supported Formats

json

Errors

Code Description
401 Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
403 Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource.
404 Not Found. The requested resource could not be found.
422 Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors.
500 Internal Server Error. An unexpected condition was encountered.

Examples

Response:
  {
      "page": 1,
      "per_page": 50,
      "total_pages": 1,
      "total_entries": 1,
      "entries": [
        {
            "id": 1,
            "code": "npc_entity_1",
            "name": "NPC Entity 1",
            "product_class": {
                "id": 7,
                "name": "Season"
            },
            "product_family": {
                "id": 1,
                "code": "family_1",
                "name": "Family 1"
            },
            "attribute_values": [
                {
                    "attribute_definition_id": 16,
                    "attribute_definition_code": "season",
                    "data": "Winter"
                }
            ]
        }
      ]
  }

Params

Param name Description
per_page
optional

Number of objects in one response. Default is 50

Validations:

  • Must be a number.

page
optional

Page number. Default is 1

Validations:

  • Must be a number.

created_time_from
optional

ISO_8601 format 2016-05-30T05:13:26Z

Validations:

  • Must be a String

created_time_to
optional

ISO_8601 format 2016-05-30T05:13:26Z

Validations:

  • Must be a String

updated_time_from
optional

ISO_8601 format 2016-05-30T05:13:26Z

Validations:

  • Must be a String

updated_time_to
optional

ISO_8601 format 2016-05-30T05:13:26Z

Validations:

  • Must be a String

id
optional

Npc Entity ID

Validations:

  • Must be a String

code
optional

Npc Entity code

Validations:

  • Must be a String

name
optional

Npc Entity name

Validations:

  • Must be a String

response_associated_fields
optional

One of ‘product_class’, ‘product_family’, ‘attribute_values’. The information related to the npc entity to be included in the npc entity data response. Use comma to join multiple fields.

Validations:

  • Must be a String


POST /api/v2/npc_entities DEPRECATED
Create or update npc entity

Supported Formats

json

Errors

Code Description
401 Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
403 Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource.
404 Not Found. The requested resource could not be found.
422 Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors.
500 Internal Server Error. An unexpected condition was encountered.

Examples

request:
  {
    "npc_entity": {
        "code": "npc_entity_1",
        "name": "NPC Entity 1",
        "product_class_name": "Season",
        "product_family_code": "family_1",
        "attribute_values": {
            "season": "Winter",
            "family_attr_1": "family1"
        },
        "media_items": [
          {
            "media_item_type": "ImageMediaItem",
            "url": "http://s3.amazonaws.com/cc/image1.jpg",
            "description": "",
            "sort_order": 0,
            "is_primary": false,
            "is_uploaded": null,
            "tag_list": []
          }
        ],
        "price_items": [
          {
            "amount": 45,
            "enabled?": true,
            "price_book_name": "default",
            "from": null,
            "to": null
          }
        ],
        "categories": [
          {
            "path": "Engine Oil",
            "is_primary": true,
            "category_set": "default"
          }
        ],
    }
  }

response:
  {
    "id": 1,
    "code": "npc_entity_1",
    "product_class_id": 7,
    "product_family_id": 1,
    "created_at": "2019-08-30T16:16:05.302+10:00",
    "updated_at": "2019-09-02T15:05:37.613+10:00",
    "name": "NPC Entity 1"
  }


Params

Param name Description
npc_entity
required

Validations:

  • Must be a Hash

npc_entity[code]
required

Code of the npc entity

Validations:

  • Must be a String

npc_entity[name]
required

Name of the npc entity

Validations:

  • Must be a String

npc_entity[product_class_name]
required

Class name that this product is assigned to. This must be created beforehand

Validations:

  • Must be a String

npc_entity[product_family_code]
optional , nil allowed

Product family code

Validations:

  • Must be a String

npc_entity[attribute_values]
optional , nil allowed

Attribute values assigned to the NPC entity.

Validations:

  • Must be a Hash

npc_entity[media_items]
optional , nil allowed

Set media items to the entity (existing media items will be removed).

Validations:

  • Must be an Array of nested elements

npc_entity[media_items][media_item_type]
optional , nil allowed

Validations:

  • Must be one of: ImageMediaItem, VideoMediaItem, FileMediaItem.

npc_entity[media_items][url]
optional , nil allowed

URL that stores the corresponding media item

Validations:

  • Must be a String

npc_entity[media_items][description]
optional , nil allowed

Description for the media item

Validations:

  • Must be a String

npc_entity[media_items][sort_order_position]
optional , nil allowed

The position of the media item. Non negative integer is supported

Validations:

  • Must be a Integer

npc_entity[media_items][is_primary]
optional , nil allowed

Make this media item as primary

Validations:

  • Must be one of: true, false, 1, 0.

npc_entity[media_items][tag_list]
optional , nil allowed

Tags for this media item

Validations:

  • Must be an array of String

npc_entity[media_items][processing_options]
optional , nil allowed

Options to perform extra image processing on the media item. This is applicable only when media_item_type is ‘ImageMediaItem’

Validations:

  • Must be a Hash

npc_entity[media_items][processing_options][apply_background]
optional , nil allowed

Setting this to true would result in a new media item created against the product with background applied. Removes transparency.

Validations:

  • Must be one of: true, false, 1, 0.

npc_entity[media_items][processing_options][background_colour]
optional , nil allowed

The colour name or a hex colour code for the background colour for the created media item. Defaults to white.

Validations:

  • Must be a String

npc_entity[media_items][processing_options][processed_tags]
optional , nil allowed

The tags for the created media item.

Validations:

  • Must be an array of String

npc_entity[price_items]
optional , nil allowed

Add new prices or update existing prices if they exist.

Validations:

  • Must be an Array of nested elements

npc_entity[price_items][price_book_name]
optional , nil allowed

Name of an existing price book to which this price item is linked

Validations:

  • Must be a String

npc_entity[price_items][from]
optional , nil allowed

Valid from

Validations:

  • Must be a String

npc_entity[price_items][to]
optional , nil allowed

Valid to

Validations:

  • Must be a String

npc_entity[price_items][amount]
optional , nil allowed

Validations:

  • Must be a Numeric

npc_entity[categories]
optional , nil allowed

Set the npc entity’s categories to these categories (existing categories will be removed)

Validations:

  • Must be an Array of nested elements

npc_entity[categories][id]
optional , nil allowed

Category ID

Validations:

  • Must be a Integer


DELETE /api/v2/npc_entities/:id DEPRECATED
Delete a npc entity

Supported Formats

json

Errors

Code Description
401 Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
403 Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource.
404 Not Found. The requested resource could not be found.
422 Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors.
500 Internal Server Error. An unexpected condition was encountered.

Examples

response:
  {
    "id": 1
  }