Serialization

The “serialization-service” provides methods for creating SGTIN and LGTIN

Requirements

  1. User's session must contain field “current_participant”.
{
  "id": "urn:authenticateit:user:email:my@gmail.com",
  "name": "ivan",
  "roles": [
    "user"
  ],
  "ticket": "7b758d11-a597-44ae-8ab4-dd3cf864e20f",
  "current_participant": {
    "id": "urn:epc:sgln:0614141.12345.1"
  }
}
  1. This participant must be presented in doc_storage with “type” field equals to “outsource” or “manufacturer”. Document also must provide a list of company prefixes
{
  "_id": "urn:epc:sgln:0614141.12345.1",
  "type": "participant",
  "participant_type": [
    "manufacturer"
  ],
  "company_prefix": [
    "0614141"
  ]
}

Create SGTINs or LGTINs with requested paremeters

Start serialization process with the given parameters. Responds with JSON object containing serialization task id. The returned identifier may be used to request task status.

POST /serialization-service/serialize
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
gtin base gtin “00614141791304”
format serialization format “gs1” or “epc”
type serialization type “sgtin” or “lgtin”
count requested number integer
data_type "numeric" or "alphanumeric"
length integer from 1 to 20
sequence sequence option “ordered” or “random”
owner owner of serialized gtin not required
settings export settings not required, if not presented - use default
labels_as_titles labels as titles in csv header “yes” or “no”, default “no”
code gs1 code in csv “yes” or “no”, default “yes”
owner owner id in csv “yes” or “no”, default “no”
delimiter delimiter in csv default "|"
name export product name in csv “yes” or “no”, default “no”
ai GS1 AI to be included in SGTIN or LGTIN Optional date (11–17) and measurement (310-369) AI.
participant Participant identifier Assing child supply chain participant as SGTIN owner
location Business location identifier Assing business location owner as SGTIN owner
source Additional source in SGTIN or LGTIN doc single source object
sources Additional sources in SGTIN or LGTIN doc list of source objects
Example Request
{
  "gtin": "02933451000009",
  "name": "Butter",
  "type": "lgtin",
  "format": "epc",
  "count": 2,
  "ai": [
    "12180608"
  ],
  "sequence": "random",
  "length": 12,
  "data_type": "alphanumeric",
  "source": {
    "data": [
      {
        "text": {
          "title": "44",
          "text": "444444"
        }
      },
      {
        "text": {
          "title": "55",
          "text": "555555"
        }
      }
    ],
    "conditions": {
      "country": "036",
      "language": "zh"
    }
  }
}
{
  "gtin": "02933451000009",
  "name": "Shoes",
  "type": "sgtin",
  "format": "gs1",
  "count": 3,
  "ai": [
    "13180609",
    "15180602",
    "16180609",
    "3110000033",
    "17180602"
  ],
  "sequence": "random",
  "length": 12,
  "data_type": "numeric",
  "sources": [
    {
      "conditions": {},
      "data": [
        {
          "text": {
            "title": "text",
            "text": "Update SGTIN widget",
            "markdown": false
          }
        },
        {
          "link": {
            "text": "Link",
            "url": "http://www.facebook.com/shping"
          }
        }
      ]
    }
  ]
}
Example Response
{
  "id": "ff79bfae-3713-49ec-8551-2f29bb4d3b72"
}

Get status of serialization

Get status of previously started serialization task.

GET /serialization-service/serialize/:task_id
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
task_id string Serialization task identifier.
Example Response
{
  "progress": 100,
  "status": "started"
}
{
  "status": "done",
  "link": "https://dev-test-cdn.shping.com/2016-12-04T19:44:49Z-b3c59bfa-4f8e-431e-b445-de2417cdffa8.csv"
}
{
  "error": "Serialization not has been started"
}

Get serialization tasks

Returns list of previously started serialization tasks.

Number of returned tasks may be limited with the limit parameter (default valus is 100). Number of tasks may be skipped from the list with the offset parameter (0 by default).

Returned tasks may be filtered by status (either started or done), gtin, name (tasks for GTINs with product name matching this string).

The resulting list may be sorted. Parameter sort_by should be used to specify sorting field (start_time, gtin, name or status). Sorting order may be specified with sort_order parameter (asc for ascending order and desc for descending order).

GET /serialization-service/tasks
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
offset Skip number of tasks from the resulting list.
limit Limite the number of tasks in the resulting list.
from_date Only tasks started after this date.
to_date Only tasks started before this date.
status Only tasks with this status.
gtin Only tasks for the GTIN.
name Only tasks for products matching this name.
sort_by Sort tasks by field.
sort_order Ascending or descending sort order.
Example Response
{
  "id": "task_serialization",
  "serialization_list": [
    {
      "ai": "02",
      "check_digit": "4",
      "company_prefix": "0614141",
      "count": 10,
      "end_time": "2016-12-03T13:00:43Z",
      "epc_header": "urn:epc:id:lgtin:0614141.079130.",
      "gs1_header": "020061414179130410",
      "gtin": "00614141791304",
      "indicator": "0",
      "item_reference": "79130",
      "link": "https://dev-test-cdn.shping.com/2016-12-03T13:00:40Z-6d20f9c0-811b-4829-b899-9512ef4ad356.csv",
      "owner": "urn:epc:sgln:0614141.12345.1",
      "participant": "urn:epc:sgln:0614141.123451",
      "sequence": "random",
      "settings": {
        "code": "no",
        "delimiter": "|",
        "labels_as_titles": "yes",
        "name": "yes",
        "owner": "yes"
      },
      "start_time": "2016-12-03T13:00:40Z",
      "type": "lgtin",
      "user": "urn:epc:sgln:0614141.12345.1"
    },
    {
      "ai": "02",
      "check_digit": "4",
      "company_prefix": "0614141",
      "count": 10,
      "end_time": "2016-12-03T10:18:50Z",
      "epc_header": "urn:epc:id:lgtin:0614141.079130.",
      "gs1_header": "020061414179130410",
      "gtin": "00614141791304",
      "indicator": "0",
      "item_reference": "79130",
      "last_element": "urn:epc:id:lgtin:0614141.079130.0000010030",
      "link": "https://dev-test-cdn.shping.com/2016-12-03T10:18:25Z-6efdca22-e049-4f6d-9faa-ac4b7c739e1f.csv",
      "owner": "urn:epc:sgln:0614141.12345.1",
      "participant": "urn:epc:sgln:0614141.12345.1",
      "sequence": "ordered",
      "settings": {
        "code": "no",
        "delimiter": "|",
        "labels_as_titles": "yes",
        "name": "yes",
        "owner": "yes"
      },
      "start_time": "2016-12-03T10:18:25Z",
      "type": "lgtin",
      "user": "urn:epc:sgln:0614141.12345.1"
    }
  ]
}

results matching ""

    No results matching ""