Products

Get categories

GET /products/categories

Query string parameters

Response
Status code 200

{
  "data": [
    {
      "id": 1,
      "name": "Category 1",
      "created_at": "2015-02-03 12:00:00",
      "updated_at": "2015-02-03 12:00:00"
    },
    {
      "id": 2,
      "name": "Category 2",
      "created_at": "2015-02-03 12:00:00",
      "updated_at": "2015-02-03 12:00:00"
    },
    {
      "id": 3,
      "name": "Category 3",
      "created_at": "2015-02-03 12:00:00",
      "updated_at": "2015-02-03 12:00:00"
    },
    {
      "id": 4,
      "name": "Category 4",
      "created_at": "2015-02-03 12:00:00",
      "updated_at": "2015-02-03 12:00:00"
    }
  ],
  "pagination": {
    "total": 4,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": null
    }
  }
}

Get a category

GET /products/categories/:category_id

Response
Status code 200

{
  "id": 1,
  "name": "Category 1",
  "created_at": "2015-02-03 12:00:00",
  "updated_at": "2015-02-03 12:00:00"
}

Create a category

POST /products/categories

Parameters

  • name string - Name of the category.
    • Max 255 characters
    • Required

Payload

{
  "name": "Some category name"
}

Response
Status code 201

{
  "id": 23463,
  "name": "Some category name",
  "created_at": "2015-02-03 11:58:53",
  "updated_at": "2015-02-03 11:58:53"
}

Update a category

PUT /products/categories/:category_id

Parameters

  • name string - Name of the category.
    • Max 255 characters
    • Required

Payload

{
  "name": "Some updated category name"
}

Response
Status code 200

{
  "id": 23463,
  "name": "Some updated category name",
  "created_at": "2015-02-03 11:58:53",
  "updated_at": "2015-02-03 11:58:53"
}

Delete a category

DELETE /products/categories/:category_id

Response
Status code 204

All products

GET /products

Query string parameters

Response
Status code 200

{
  "data": [
    {
      "id": "ed75dc42-f995-45e0-6214-cb9ae41fc822",
      "category": {
        "id": 3,
        "name": "Some category",
        "created_at": "2015-02-03 12:00:00",
        "updated_at": "2015-02-03 12:00:00"
      },
      "fixed_fields": [
        {
          "type": "text",
          "name": "name",
          "label": "Name",
          "value": "Some product name",
          "validation": null,
          "required": true
        },
        {
          "type": "numeric",
          "name": "list_price",
          "label": "List price",
          "value": 55235848.23,
          "validation": "numeric",
          "required": true
        },
        {
          "type": "numeric",
          "name": "purchase_price",
          "label": "Purchase price",
          "value": 333.22,
          "validation": "numeric",
          "required": true
        },
        {
          "type": "single_choice",
          "name": "type",
          "label": "Type",
          "value": {
            "id": 487,
            "value": "Hours"
          },
          "validation": null,
          "required": true
        },
        {
          "type": "numeric",
          "name": "tax",
          "label": "Tax",
          "value": 32,
          "validation": "numeric",
          "required": true
        }
      ],
      "custom_fields": [],
      "created_at": "2015-02-04 12:00:43",
      "updated_at": "2015-02-04 12:00:43"
    }
  ],
  "pagination": {
    "total": 1,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": null
    }
  }
}

Find a product

GET /products/:product_id

Response
Status code 200

{
  "id": "ed75dc42-f995-45e0-6214-cb9ae41fc822",
  "category": {
    "id": 3,
    "name": "Some category",
    "created_at": "2015-02-03 12:00:00",
    "updated_at": "2015-02-03 12:00:00"
  },
  "fixed_fields": [
    {
      "type": "text",
      "name": "name",
      "label": "Name",
      "value": "Some product name",
      "validation": null,
      "required": true
    },
    {
      "type": "numeric",
      "name": "list_price",
      "label": "List price",
      "value": 55235848.23,
      "validation": "numeric",
      "required": true
    },
    {
      "type": "numeric",
      "name": "purchase_price",
      "label": "Purchase price",
      "value": 333.22,
      "validation": "numeric",
      "required": true
    },
    {
      "type": "single_choice",
      "name": "type",
      "label": "Type",
      "value": {
        "id": 487,
        "value": "Hours"
      },
      "validation": null,
      "required": true,
      "hidden": false,
      "read_only": false,
      "sort_order": 0,
      "options": [
        {
          "id": 487,
          "value": "Hours",
          "checked": true
        },
        {
          "id": 488,
          "value": "Pieces",
          "checked": false
        }
      ]
    },
    {
      "type": "numeric",
      "name": "tax",
      "label": "Tax",
      "value": 32,
      "validation": "numeric",
      "required": true
    }
  ],
  "custom_fields": [],
  "created_at": "2015-02-04 12:00:43",
  "updated_at": "2015-02-04 12:00:43"
}

Create a product

POST /products

Parameters

  • category.id array
    • category.id.* integer
  • Supports Fields

Deprecated parameters

  • category_id in favor of category.id
    • Removal: 2018/04/01

Payload

{
  "category": {
    "id": [
      1,
      2
    ]
  },
  "fixed_fields" : [
    {
      "name": "name",
      "value": "Product name"
    },
    {
      "name": "list_price",
      "value": 123.45
    },
    {
      "name": "purchase_price",
      "value": 543.21
    },
    {
      "name": "type",
      "value": 502
    },
    {
      "name": "vat",
      "value": 12
    }
  ]
}

Response
Status code 201

{
  "id": "e08e5daa-c7e3-48f6-9de2-4be098736a41",
  "category": {
    "id": 1,
    "name": "Category 1",
    "created_at": "2015-02-03 12:00:00",
    "updated_at": "2015-02-03 12:00:00"
  },
  "fixed_fields": [
    {
      "type": "text",
      "name": "name",
      "label": "Name",
      "value": "Product name",
      "validation": null,
      "required": true
    },
    {
      "type": "numeric",
      "name": "list_price",
      "label": "List price",
      "value": 123,
      "validation": "numeric",
      "required": true
    },
    {
      "type": "numeric",
      "name": "purchase_price",
      "label": "Purchase price",
      "value": 543,
      "validation": "numeric",
      "required": true
    },
    {
      "type": "single_choice",
      "name": "type",
      "label": "Type",
      "value": {
        "id": 488,
        "value": "Pieces"
      },
      "validation": null,
      "required": true,
      "hidden": false,
      "read_only": false,
      "sort_order": 0,
      "options": [
        {
          "id": 487,
          "value": "Hours",
          "checked": false
        },
        {
          "id": 488,
          "value": "Pieces",
          "checked": true
        }
      ]
    },
    {
      "type": "numeric",
      "name": "tax",
      "label": "Tax",
      "value": 12,
      "validation": "numeric",
      "required": true
    }
  ],
  "custom_fields": [],
  "created_at": "2015-02-04 12:52:33",
  "updated_at": "2015-02-04 12:52:33"
}

Update a product

PUT /products/:product_id

Parameters

  • category.id array
    • category.id.* integer
  • Supports Fields

Deprecated parameters

  • category_id in favor of category.id
    • Removal: 2018/04/01

Payload

{
  "category": {
    "id": [
      1,
      2
    ]
  },
  "fixed_fields" : [
    {
      "name": "name",
      "value": "Product name - Updated"
    },
    {
      "name": "list_price",
      "value": 123.45
    },
    {
      "name": "purchase_price",
      "value": 543.21
    },
    {
      "name": "type",
      "value": 502
    },
    {
      "name": "vat",
      "value": 12
    }
  ]
}

Response
Status code 200

{
  "id": "e08e5daa-c7e3-48f6-9de2-4be098736a41",
  "category": {
    "id": 1,
    "name": "Category 1",
    "created_at": "2015-02-03 12:00:00",
    "updated_at": "2015-02-03 12:00:00"
  },
  "fixed_fields": [
    {
      "type": "text",
      "name": "name",
      "label": "Name",
      "value": "Updated name",
      "validation": null,
      "required": true
    },
    {
      "type": "numeric",
      "name": "list_price",
      "label": "List price",
      "value": 123,
      "validation": "numeric",
      "required": true
    },
    {
      "type": "numeric",
      "name": "purchase_price",
      "label": "Purchase price",
      "value": 543,
      "validation": "numeric",
      "required": true
    },
    {
      "type": "single_choice",
      "name": "type",
      "label": "Type",
      "value": {
        "id": 488,
        "value": "Pieces"
      },
      "validation": null,
      "required": true,
      "hidden": false,
      "sort_order": 0,
      "options": [
        {
          "id": 487,
          "value": "Hours",
          "checked": false
        },
        {
          "id": 488,
          "value": "Pieces",
          "checked": true
        }
      ]
    },
    {
      "type": "numeric",
      "name": "tax",
      "label": "Tax",
      "value": 12,
      "validation": "numeric",
      "required": true
    }
  ],
  "custom_fields": [],
  "created_at": "2015-02-04 12:52:33",
  "updated_at": "2015-02-04 12:54:24"
}

Delete a product

DELETE /products/:product_id

Response
Status code 204