The MPK (cost center) resource has the following attributes:
Attribute | Type | Description |
---|---|---|
name | String | Name of cost center |
description | String | Cost center description |
Sample MPK resource in the JSON format:
{ "href": "https://api-shipx-pl.easypack24.net/v1/mpks/1", "id": 1, "name": "Nazwa miejsca powstania kosztów", "description": "Opis miejsca powstania kosztów", "created_at": "2018-05-15T21:58:49.427+02:00", "updated_at": "2018-05-17T10:35:59.644+02:00" }
Authentication
Access to the resource requires provision of the correct and valid access token for the Organization.
Downloading the collection of cost centers
Collecting lists of all cost centers for the selected organization.
GET /v1/organizations/:organization_id/mpks
The resource is paged.
Parameters
Parameter | Description |
---|---|
sort_by | Determines the attribute on which the results are to be sorted. |
sort_order | Determines the sorting type - descending(desc) or ascending (asc). |
Sample request
GET /v1/organizations/:organization_id/mpks HTTP/1.1 Host: api-shipx-pl.easypack24.net Content-Type: application/json
Response
In the response the server will return collections with the MPK (cost center) list and HTTP 200 OK code
HTTP/1.1 200 OK Content-Type: application/json { "href": "http://api-shipx-pl.easypack24.net:3000/v1/organizations/1/mpks", "count": 3, "page": 1, "per_page": 30, "items": [ { "href": "https://api-shipx-pl.easypack24.net/v1/mpks/3", "id": 3, "name": "First", "description": "Some New Description 1", "created_at": "2018-05-16T13:36:28.332+02:00", "updated_at": "2018-05-16T13:36:28.332+02:00" }, { "href": "https://api-shipx-pl.easypack24.net/v1/mpks/2", "id": 2, "name": "Second", "description": "Some New Description 2", "created_at": "2018-05-16T13:33:03.745+02:00", "updated_at": "2018-05-17T09:56:11.500+02:00" }, { "href": "https://api-shipx-pl.easypack24.net/v1/mpks/1", "id": 1, "name": "Third", "description": "Some New Description 3", "created_at": "2018-05-15T21:58:49.427+02:00", "updated_at": "2018-05-15T22:31:04.316+02:00" } ] }
Creating a cost center
POST /admin/v1/organizations/organization_id/mpks
The server will return a HTTP response with the 201 Created status.
Parameters
Parameter | Type | Description | Requirements |
---|---|---|---|
name | String | Name of cost center | • The attribute is required • The attribute value is unique within the organization • Maximum length 255 characters |
description | String | Cost center description | • The attribute is required |
Sample request
POST /v1/organizations/:organization_id/mpks HTTP/1.1 Host: api-shipx-pl.easypack24.net Content-Type: application/json { "name": "Nazwa miejsca powstania kosztów", "description": "Opis miejsca powstania kosztów" }
Sample response
HTTP/1.1 201 Created Location: https://api-shipx-pl.easypack24.net/v1/mpks/3 Content-Type: application/json { "href": "https://api-shipx-pl.easypack24.net/v1/mpks/3", "id": 3, "name": "Nazwa miejsca powstania kosztów", "description": "Opis miejsca powstania kosztów", "created_at": "2018-05-16T13:36:28.332+02:00", "updated_at": "2018-05-16T13:36:28.332+02:00" }
Errors:
resource_not_found
- the organization with the stated ID does not exist
Updating the place of collection order
PUT /v1/mpks/:mpk_id
Parameters
Parameter | Type | Description | Requirements |
---|---|---|---|
name | String | Name of cost center | • The attribute is required • The attribute value is unique within the organization • Maximum length 255 characters |
description | String | Cost center description | • The attribute is required |
Sample request
PUT /v1/mpks/:mpk_id HTTP/1.1 Host: api-shipx-pl.easypack24.net Content-Type: application/json { "name": "Nazwa miejsca powstania kosztów", "description": "Opis miejsca powstania kosztów", }
Response
After completing the request correctly, the server will return a response containing the mpk object with the changed data, with HTTP 200 OK code.
HTTP/1.1 200 OK Content-Type: application/json { "href": "https://api-shipx-pl.easypack24.net/admin/v1/mpks/1", "id": 1, "name": "Nazwa miejsca powstania kosztów", "description": "Opis miejsca powstania kosztów", "created_at": "2018-05-15T21:58:49.427+02:00", "updated_at": "2018-05-17T10:35:59.644+02:00" }
Errors:
resource_not_found
- webhook with the stated ID does not exist,
Downloading a single object
GET /v1/mpks/1
Sample request
GET /v1/mpks/1 HTTP/1.1 Host: api-shipx-pl.easypack24.net Content-Type: application/json X-ShipX-OrganizationId: 1
Response
HTTP/1.1 200 No Content Content-Type: application/json { "href": "https://api-shipx-pl.easypack24.net/v1/mpks/1", "id": 1, "name": "Nowa nazwa miejsca powstania kosztów", "description": "Nowy opis miejsca powstania kosztów", "created_at": "2018-05-15T21:58:49.427+02:00", "updated_at": "2018-05-15T22:31:04.316+02:00" }