Export items

Definition

POST /apis/v2/{SERVICE_ID}/{ITEMS_NAME}/export

Description

Generate a .b2b file which contains the list of items.

Details:

  • If there is an error with the export of an item, the other items will still be exported.
  • If the body parameter is null, all the items will be exported.

Permissions

The user needs to have the permissions:

SERVICE_ID=read && SERVICE_ID=edit

To export an item, the user needs to have the associated Application Publisher Profile, if not the item’s content mode is should be set to any value but NONE.

Parameters

The body request parameter is a JSON array containing the list of identifiers of the items to export.

Type Mandatory Description
JSON Array yes The list of identifiers

Example:

[
    {
        "appKey": "",
        "name": "AuthTokenCall"
    },
    {
        "appKey": "",
        "name": "Imerys Talc - JDE"
    }
]

Response

HTTP code Reason
200 Success
500 Unexpected exception

When the query is successful, the HTTP response is a 200 OK is and returns the list of the items:

[
    {
        "appKey": "",
        "classScripts": {},
        "contentMode": "READ",
        "description": { "EN": "Testing AuthTokenCall" },
        "lastModifiedBy": "roxane.mace@amalto.com",
        "lastModifiedDate": 1520599882640,
        "mainScript": "import com.amalto.b2box.core.api.adapter.AdapterAction;\n [...]",
        "name": "AuthTokenCall",
        "resources": [],
        "revisionId": "0ae6a3e1efdb8a84aa60cdda3925ce9a"
    },
    {
        "appKey": "",
        "classScripts": {},
        "contentMode": "READ",
        "description": { "EN": "Imerys Talc - JDE" },
        "lastModifiedBy": "roxane.mace@amalto.com",
        "lastModifiedDate": 1519819361188,
        "mainScript": "import org.apache.commons.io.FileUtils;\nimport groovy.sql.Sql;\nimport java.text.DecimalFormat;\n [...]",
        "name": "Imerys Talc - JDE",
        "resources": [{
            "byteContent": null,
            "compiledContent": "\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; [...]",
            "content": "const WORDINGS = {\n\n 'customcomponent.cancel': {\n [...]",
            "name": "AWF_CorrectInvoice_Form",
            "type": "TYPESCRIPT"
        }],
        "revisionId": "c29f2b000a568dd8cdfeef474265651c"
    }
]

If there any error during the process with an item, it won’t be returned in the response and an error will be logged. Thus, the HTTP response will always be a 200 OK.

Logs

Since the response of the request is returned in a .b2b file, the errors in the form of a multi-error object are not returned but logged in the shell.

Here are the potential errors encountered during export:

Error code Reason
400 Invalid parameter count or content
403 Unauthorized
404 Not found
500 Unexpected exception