Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Latest commit

 

History

History
153 lines (128 loc) · 3.76 KB

File metadata and controls

153 lines (128 loc) · 3.76 KB

Get Import Progress

Get the progress of an import.

{% hint style="info" %} It requires the run-import permission. {% endhint %}

URL Requires Auth HTTP Method
/api/v1/getImportProgress yes GET

Headers

ArgumentExampleRequiredDescription
X-User-Idmyuser-nameRequiredThe authenticated user ID.
X-Auth-Tokenmyauth-tokenRequiredAuth token.

Example Call

{% tabs %} {% tab title="Curl" %}

curl -L -X GET 'http://localhost:3000/api/v1/getImportProgress' \
-H 'X-User-Id: d26x6zSkaPSe5gCyy' \
-H 'X-Auth-Token: Zu-Z6eKzIIz7MCCRGeHi29bYkXZCJ4SxFC0JAasqm92'

{% endtab %}

{% tab title="Node.js" %}

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'http://localhost:3000/api/v1/getImportProgress',
  'headers': {
    'X-User-Id': 'd26x6zSkaPSe5gCyy',
    'X-Auth-Token': 'Zu-Z6eKzIIz7MCCRGeHi29bYkXZCJ4SxFC0JAasqm92'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

{% endtab %}

{% tab title="Python" %}

import requests

url = "http://localhost:3000/api/v1/getImportProgress"

payload={}
headers = {
  'X-User-Id': 'd26x6zSkaPSe5gCyy',
  'X-Auth-Token': 'Zu-Z6eKzIIz7MCCRGeHi29bYkXZCJ4SxFC0JAasqm92'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

{% endtab %}

{% tab title="PHP" %}

<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('http://localhost:3000/api/v1/getImportProgress');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'X-User-Id' => 'd26x6zSkaPSe5gCyy',
  'X-Auth-Token' => 'Zu-Z6eKzIIz7MCCRGeHi29bYkXZCJ4SxFC0JAasqm92'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}

{% endtab %}

{% tab title="Java" %}

Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://localhost:3000/api/v1/getImportProgress")
  .header("X-User-Id", "d26x6zSkaPSe5gCyy")
  .header("X-Auth-Token", "Zu-Z6eKzIIz7MCCRGeHi29bYkXZCJ4SxFC0JAasqm92")
  .asString();

{% endtab %} {% endtabs %}

Example Result

Success

{
    "key": "pending-avatars",
    "name": "Pending Avatars",
    "step": "importer_user_selection",
    "count": {
        "completed": 0,
        "total": 0
    },
    "success": true
}

Error

Any of the following errors can occur on the endpoint.

  • Authorization: Requires an authentication token for the request to be made.
  • No Permission: This occurs when the authenticated user doesn't have the run-import permission.

{% tabs %} {% tab title=" Authorization" %}

{
    "success": false,
    "error": "unauthorized"
}

{% endtab %}

{% tab title="No Permission" %}

{
    "success": false,
    "error": "User does not have the permissions required for this action [error-unauthorized]"
}

{% endtab %} {% endtabs %}

Change Log

Version Description
3.0.0 Added