(Quick Reference) Service: Create a serial number

Description: Returns the created serial number in json format when successful. Returns a json response, describing the failure condition when unsuccessful.

URL:

https://BASE_URL/api/VERSION/serialNumbers

Method: POST

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
value StringRequired if single save 
itemId Long/Stringyes 
valueslist of unique serial numbers valuesJSON listRequired if multiple save["7B341","4F1AE2"]
useExternalIdBy default, it is set to false. set it to true if you want to use external ids.Booleannotrue , false

Success Output (single save)

Status: HTTP/1.1 201 Created

{
  "id": 2704566,
  "value": "74924P109E",
  "status": "NEW",
  "itemId": 771,
  "item": {
    "id": 771,
    "reference": "LENOVO-A7010-WHITE",
    "href": "/api/v1.0/items/771"
  },
  "organization": "entity1",
  "dateCreated": "2016-11-08T08:25:05Z",
  "lastUpdated": "2016-11-08T08:25:05Z"
}

Success Output (multiple save)

Status: HTTP/1.1 201 Created

{
  "data": [
    {
      "id": 2704620,
      "value": "4F1341",
      "status": "NEW",
      "itemId": 785,
      "item": {
        "id": 785,
        "reference": "eliteBook_revolve_810",
        "href": "/api/v1.0/items/785"
      },
      "warehouseStockId": null,
      "organization": "entity1",
      "dateCreated": "2016-11-08T15:19:35Z",
      "lastUpdated": "2016-11-08T15:19:35Z"
    },
    {
      "id": 2704621,
      "value": "7BAE2",
      "status": "NEW",
      "itemId": 785,
      "item": {
        "id": 785,
        "reference": "eliteBook_revolve_810",
        "href": "/api/v1.0/items/785"
      },
      "warehouseStockId": null,
      "organization": "entity1",
      "dateCreated": "2016-11-08T15:19:35Z",
      "lastUpdated": "2016-11-08T15:19:35Z"
    }
  ]
}

Failure Output

Status: HTTP/1.1 400 Bad Request

{
  "error": "save_failed",
  "error_description": "Failed to save instance."
}

{
  "error": "invalid_param_type",
  "error_description": "The type of parameter itemId you provided is not valid for this request."
}

{
  "error": "not_unique",
  "error_description": "value already used"
}

{
  "error": "not_unique",
  "error_description": "Serial number must be unique"
}
{
  "error": "not_unique",
  "error_description": "serial number value already used"
}

Status: HTTP/1.1 404 Not Found

{
  "error": "not_found",
  "error_description": "The item with the id 77 doesn't exist."
}