Tag bulk import resources

Upload Excel file

Allows to upload and validate a tag bulk import file. No tags will be written to the database.

Uploads MUST be performed using the multipart/form-data Content-Type.

Only the Starmind tag bulk import excel file is supported.

POST /import/tags/upload

This request will return immediately while the actual validation is running async in the background where an import process of "type" validation will be triggered.

Parameter Type Default Required Description
file file The tag bulk import file

Response

{
  "import_id": 73,
  "user_id": 17267,
  "file_name": "test_tag_import.xlsx"
}

If no validation errors occurred, the file is persisted within Starmind (import_id) and ready for being imported.


Import Excel file

PUT /import/tags/:ID

Triggers the import of a previously uploaded tag bulk import file. :ID correlates with the "import_id" returned from the upload response.

The import will create or update the actual tags in the database.

This request will return immediately while the actual import is running async in the background where an import process of "type" import will be triggered.

Response

{
  "import_id": 76,
  "user_id": 17267,
  "file_name": "test_tag_import.xlsx"
}

Check process status

Since the validation / import is executed async, the process status must be checked before proceeding to the next step. The :ID correlates with the "import_id" returned from the upload / import response.

GET /import/tags/:ID/status

Returns the current state of a validation / import process.

The process "status" field can have following values:

"success", "processing", "error"

The process "type" field can have following values:

"validation", "import"

So, per tag import two import processes will be created.

Response

Example for successful xlsx import.

{
  "start_date": "2015-12-11T07:15:50.000Z",
  "result": {
    "file_name": "user_2015-12-11T07:15:50.192Z.json",
    "created_records": 1,
    "errors": [],
    "updated_records": 0,
    "import_id": 73
  },
  "end_date": "2015-12-11T07:16:08.000Z",
  "status": "success",
  "message": null,
  "import_id": 73,
  "type": "import"
}

Example for a failed xlsx validation.

{
  "start_date": "2015-12-12T07:15:50.000Z",
  "result": {
    "file_name": "tag_2015-12-12T07:15:50.192Z.xlsx",
    "created_records": 0,
    "errors": [
        {
          "msg": "requirement failed: Tag length must be between 2 and 255 characters.",
          "metadata": "C",
          "row": 6,
          "field": "Tags"
        }
    ],
    "updated_records": 0,
    "user_id": 17267,
    "import_id": 73
  },
  "end_date": "2015-12-12T07:30:08.000Z",
  "status": "error",
  "message": null,
  "import_id": 73,
  "type": "validation"
}

List process states

List all tag validation / import process states.

GET /import/users/status
[
  {
    "start_date": "2015-12-12T07:15:50.000Z",
    "result": {
      "file_name": "tag_2015-12-12T07:15:50.192Z.xlsx",
      "created_records": 0,
      "errors": [
          {
            "msg": "requirement failed: Tag length must be between 2 and 255 characters.",
            "metadata": "C",
            "row": 6,
            "field": "Tags"
          }
      ],
      "updated_records": 0,
      "user_id": 17267,
      "import_id": 73
    },
    "end_date": "2015-12-12T07:30:08.000Z",
    "status": "error",
    "message": null,
    "import_id": 73,
    "type": "validation"
  },
  {
    "start_date": "2015-12-11T07:15:50.000Z",
    "result": {
      "file_name": "tag_2015-12-11T07:15:50.192Z.json",
      "created_records": 1,
      "errors": [],
      "updated_records": 3,
      "user_id": 17267,
      "import_id": 73
    },
    "end_date": "2015-12-11T07:16:08.000Z",
    "status": "success",
    "message": null,
    "import_id": 73,
    "type": "import"
  }
]