Developers

Shipping methods

Summary of shipping method endpoints

List all available shipping methods for the current site

Get list of shipping methods for current site.

This endpoint also allows anonymous access.

GET /admin/api/ecommerce/v1/shipping_methods

Example response:

Status: 200 OK
[
  {
    "id": 1,
    "name": "Basic shipping",
    "amount": "10.0",
    "description": "Basic shipping without secondary options",
    "enabled": true,
    "created_at": "2016-12-05T14:57:52.000Z",
    "updated_at": "2017-03-30T11:48:07.000Z",
    "tax_rate": null,
    "options": []
  }, {
    "id": 2,
    "name": "Advanced shipping",
    "amount": "24.0",
    "description": "Advanced shipping with multiple options",
    "enabled": true,
    "created_at": "2016-12-05T14:57:52.000Z",
    "updated_at": "2017-03-30T11:48:07.000Z",
    "tax_rate": null,
    "options": [
      "option 1",
      "option 2"
    ]
  }
]

Create a new shipping method for the current site

POST /admin/api/ecommerce/v1/shipping_methods

Example data:

{
  "name": "New shipping method",
  "amount": "15.0",
  "enabled": true
}

Example response:

Status: 201 Created
{
  "id": 3,
  "name": "New shipping method",
  "amount": "15.0",
  "description": "",
  "enabled": true,
  "created_at": "2017-03-30T11:48:07.000Z",
  "updated_at": "2017-03-30T11:48:07.000Z",
  "tax_rate": null,
  "options": []
}

Get data for a single shipping method

GET /admin/api/ecommerce/v1/shipping_methods/1

This endpoint also allows anonymous access.

Example request:

GET http://helloworld.voog.com/admin/api/ecommerce/v1/shipping_methods/1

Example response:

Status: 200 OK
{
  "id": 1,
  "name": "Basic shipping",
  "amount": "10.0",
  "description": "Basic shipping without secondary options",
  "enabled": true,
  "created_at": "2016-12-05T14:57:52.000Z",
  "updated_at": "2017-03-30T11:48:07.000Z",
  "tax_rate": null,
  "options": []
}

Update attributes of a single shipping method

PUT /admin/api/ecommerce/v1/shipping_methods/1

This request updates the shipping method with provided attributes.

Example request:

PUT http://helloworld.voog.com/admin/api/ecommerce/v1/shipping_methods/1

Example data:

{
  "name": "Normal shipping"
}

Example response:

Status: 200 OK
{
  "id": 1,
  "name": "Normal shipping",
  "amount": "10.0",
  "description": "Basic shipping without secondary options",
  "enabled": true,
  "created_at": "2016-12-05T14:57:52.000Z",
  "updated_at": "2017-03-30T11:48:07.000Z",
  "tax_rate": null,
  "options": []
}

Parameters

  • name — Shipping method name as it appears in the shopping cart dropdown
  • description — A descriptive text that is shown in the shopping cart after selecting the method
  • options — List of strings that are used as sub-options for the method, e.g. possible pickup locations
  • amount — The subtotal amount of the given method
  • tax_rate — The tax rate that is used for the method's total price calculation (defaults to Store's tax_rate if not specified)
  • enabled — A boolean that controls whether the method is rendered in the cart or not

Remove a shipping method

DELETE /admin/api/ecommerce/v1/shipping_methods/1

This request deletes the given shipping method.

Example request:

DELETE http://helloworld.voog.com/admin/api/ecommerce/v1/shipping_methods/1

Example response:

Status: 204 No Content