Description

The “description-service” provides methods for creation, update and delete sources in GTIN document.

Requirements

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

GTIN

Create New Trade Item

Takes JSON object containing GTIN and name of the trade item. Company prefix in GTIN must agree with company prefixes of participant. Newly created GTIN initially do not have any information sources.

POST /description-service/gtins
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
id string Trade item identifier, GTIN
name string Trade item name
Example Response
{
  "id": "09780996791304",
  "owner": "urn:epc:sgln:0614141.12345.1",
  "name": "Fancy New Trade Item",
  "sources": []
}

Delete Trade Item

Delete trade item and all it's information sources. Current participant must be GTIN owner.

DELETE /description-service/gtins/:id
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
id string Trade item identifier, GTIN

Update Trade Item

Only name of the trade item could be changed. There is separate API endpoint to change trade item's information sources.

PUT /gtins/:id
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
id string Trade item identifier, GTIN
name string New trade item name
Example Response
{
  "id": "04444455998226",
  "name": "New New Trade Item",
  "owner": "urn:authenticateit:participant:1489226097599",
  "sources": []
}

Sources

Create new or update existing source in document

That request create new or update existing source in document Participant must has actived product360. If module product360 isn't active - participant can create only text, image and nutrition_info widgets

When adding new sources, conditions are checked. If there is complete overlap of existing conditions - sources are replaced.

"conditions":{"country":["036", "044"],"language":["en", "ru"]} -> "conditions":{"country":["036"],"language":["en"]}

If there is no complete overlap with new ones, both sources are saved. Since it means that the information is expanded to more detailed conditions

"conditions":{"country":["036"],"language":["en"]} -> "conditions":{"country":["036", "044"],"language":["en", "ru"]}
POST /description-service/description
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
id string base gtin
sources array::object list of sources - MUST contain objects with two tags “conditions” and “data”
conditions object::object MAY contain objects with two tags “language” and “country”
language array::string/string list of elements or one element
country array::string/string list of elements or one element
data array:object object with widgets
Example Request
{
  "id": "0978099679130451",
  "sources": [
    {
      "conditions": {
        "language": [
          "fr",
          "ru"
        ]
      },
      "data": [
        {
          "text": {
            "title": "Main prod",
            "text": "Some textww",
            "lines": 10
          }
        }
      ]
    },
    {
      "conditions": {
        "language": "ru",
        "country": [
          "046",
          "054"
        ]
      },
      "data": [
        {
          "text": {
            "title": "Second title",
            "text": "Bla-bla-bla."
          }
        },
        {
          "link": {
            "text": "Brand web site",
            "url": "http://www.koalabi.com.au"
          }
        }
      ]
    }
  ]
}

Removes source

That request removes source with requested “conditions”

POST /description-service/description/delete
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
id string base gtin
conditions object::object MUST contain objects with two tags “language” and “country”
language array::string/string list of elements or one element
country array:string/string list of elements or one element

Read gtin document

That request return the GTIN document by ID

GET /description-service/description
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
id string base gtin
Example Response
{
  "id": "19780996791304",
  "name": "Test product",
  "owner": "urn:epc:sgln:0614141.12345.1",
  "sources": [
    {
      "conditions": {
        "language": "ru"
      },
      "data": [
        {
          "text": {
            "text": "Bla-bla-bla.",
            "title": "Second title"
          }
        },
        {
          "link": {
            "text": "Brand website",
            "url": "http://www.koalabi.com.au"
          }
        }
      ],
      "id": "urn:authenticateit:user:email:my@gmail.com",
      "type": "contrubutor"
    },
    {
      "conditions": {
        "country": "036"
      },
      "data": [
        {
          "text": {
            "lines": 10,
            "text": "Some text",
            "title": "Main prod"
          }
        }
      ],
      "id": "urn:authenticateit:user:email:my@gmail.com",
      "type": "contrubutor"
    }
  ],
  "type": "gtin"
}

GS1 File parser

Parsing csv file

That request create new or update existing source in document

POST /description-service/parse/file
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
link aws link “dev-test-cdn.shping.com.s3-ap-southeast-2.amazonaws.com/2017/2/20/test1.csv”
delimiter delimiter “\t”
fields map of fields which are converted to text widgets {“Brand”:{“title”:“Будет вставлено в title виджета”, “position”:1},GST_Reported_Date”:“Дата”}
name fields which are converted to gtin name [“Brand”]
source_type s ource_type for source “expert”
gtin_field GTIN field in file “GTIN”
brand Optional brand field which are converted to brand document “Brand”
conditions widget conditions {“language”:“en”, “country”:[“036”, “044”]}
owner valid participant's id (default is “urn:authenticateit:participant:1”) “urn:authenticateit:participant:123456”
additional_widgets list of additional widgets
Example Request
{
  "link": "dev-cdn.shping.com.s3.amazonaws.com/2017/6/19/e47a98c0-bf8f-40e1-a5bb-a387e08d747e-Updated_ACO GTIN List 23_03_17 (1) (4).txt",
  "delimiter": "\t",
  "source_type": "expert",
  "gtin_field": "gtin",
  "fields": {
    "title": {
      "title": "Title",
      "position": 2
    },
    "DESCRIPTION": {
      "title": "Description",
      "position": 3
    },
    "Size": {
      "title": "Size",
      "position": 6
    },
    "Source": {
      "title": "Source",
      "position": 7
    },
    "Certificate": {
      "title": "Certificate",
      "position": 8
    }
  },
  "name": [
    "title"
  ],
  "conditions": {
    "language": "en",
    "country": "036"
  },
  "owner": "urn:authenticateit:participant:1487042631905",
  "additional_widgets": [
    {
      "position": 4,
      "widgets": [
        {
          "certificates": {
            "title": "Certificates",
            "list": [
              {
                "img_url": "http://dev-cdn.shping.com.s3.amazonaws.com/2017/6/20/95e287e3-490d-4c4b-bc2e-15295c2b64bd-Australian-Certified-Organic.png",
                "cid": "",
                "expired": false
              }
            ]
          }
        }
      ]
    },
    {
      "position": 5,
      "widgets": [
        {
          "video": {
            "title": "Video",
            "url": "http://dev-cdn.shping.com.s3.amazonaws.com/2017/6/19/bad421e2-64bb-4565-a0a4-a1c7e64caecb-aco.mp4",
            "preview": "http://dev-cdn.shping.com.s3.amazonaws.com/2017/6/19/ffb555c2-56fb-4283-90d5-dba970c2e0e7-img.png"
          }
        }
      ]
    }
  ]
}
Example Response
"Task in progress"

Read current parsing status

GET /description-service/parse/status
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
Example Response
{
  "message": "success",
  "status": "done",
  "ts": "2017-02-20T21:02:49Z"
}

results matching ""

    No results matching ""