Resource Representation

Example:
{
  "id": 1,
  "parent_product_id": "1",
  "child_product_id": "2 ",
  "relationship_id": "1",
  "status": active,
  "sort_order": 1
}

Supported Formats

json

GET /api/v2/product_relationships
List product relationships

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,
          "sort_order": 1,
          "status": "active",
          "relationship": {
              "id": 2,
              "name": "My Relationship 1",
              "code": "my_relationship_1"
          },
          "parent_product": {
              "id": 18,
              "code": "parent-code",
              "name": "Parent Product"
          },
          "child_product": {
              "id": 19,
              "code": "child-code",
              "name": "Child Product"
          }
        }
      ]
  }

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

Product Relationship ID

Validations:

  • Must be a String

status
optional

Product Relationship status

Validations:

  • Must be one of: active, inactive.


POST /api/v2/product_relationships
Create or update product relationship

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:
  {
    "product_relationship": {
      "status": "active",
      "sort_order": 1,
      "relationship_id": 2,
      "parent_product_id": 21,
      "child_product_id": 19
    }
  }

  or

  {
    "product_relationship": {
      "status": "active",
      "sort_order": 2,
      "relationship_code": "relationship_1",
      "parent_product_code": "product_code_1",
      "child_product_code": "product_code_2"
    }
  }


response:
  {
    "id": 2,
    "sort_order": 20,
    "status": "active",
    "relationship": {
        "id": 2,
        "name": "My Relationship 1",
        "code": "my_relationship_1"
    },
    "parent_product": {
        "id": 20,
        "code": "product_code_1",
        "name": "Product 1"
    },
    "child_product": {
        "id": 19,
        "code": "product_code_1",
        "name": "Product 2"
    }
  }

Params

Param name Description
product_relationship
required

Validations:

  • Must be a Hash

product_relationship[relationship_id]
optional , nil allowed

ID of the relationship

Validations:

  • Must be a Integer

product_relationship[relationship_code]
optional , nil allowed

Code of the relationship

Validations:

  • Must be a String

product_relationship[parent_product_id]
optional , nil allowed

ID of the parent product

Validations:

  • Must be a Integer

product_relationship[parent_product_code]
optional , nil allowed

Code of the parent product

Validations:

  • Must be a String

product_relationship[child_product_id]
optional , nil allowed

ID of the child product

Validations:

  • Must be a Integer

product_relationship[child_product_code]
optional , nil allowed

Code of the child product

Validations:

  • Must be a String

product_relationship[status]
optional , nil allowed

Validations:

  • Must be one of: inactive, active.

product_relationship[sort_order]
optional , nil allowed

Product Relationship ordering

Validations:

  • Must be a Integer


DELETE /api/v2/product_relationships/:id
Delete a relationship

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
  }