NAV Navbar
javascript php shell

Introduction

const TPS = require('tps');
<?php

use Ideea\TPS;

TPS::boot('52372b13c197b319cf2985122cfe062a8a351141c28975b235f153079d81f8b04');

This is the documentation for 3PS API. This API is used for uploading files, creating orders, and managing jobs and orders.

Items

Create Item

POST - /items/create

tps.createItem({ item_id, group_id }).then(item => {
  console.log(item);
});
<?php

$item = $tps->createItem([
  'item_id' => 'my-unique-item-id'
  'group_id' => 'my-unique-group-id'
]);
curl 'https://tps.ideea.io/api/v1/items/create' \
  -X POST \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json;' \
  --data-binary '{"item_id":"my-unique-item-id", "group_id":"my-unique-group-id"}'

Response

{
  "id": "09a35d4b-2432-419e-81a2-253538b1bbae",
  "group_id": "12420628-7d15-4a2b-91fb-af8e27c4943f"
}

To create a new bucket make a post request to /groups/{group_id}/buckets/create. This will craete the bucket with the provided data.

HTTP Endpoint

POST http://tps.ideea.io/api/v1/items/create

Request Payload

Parameter Required Description
id true The item id. This must contain only lower-case letters and hyphens
group_id true The group id. This must contain only lower-case letters and hyphens

Get Item

GET /items/{item_id}

tps.getItem('12420628-7d15-4a2b-91fb-af8e27c4943f').then(item => {
  console.log(item);
});
<?php

$item = $tps->getItem('12420628-7d15-4a2b-91fb-af8e27c4943f');

echo $item

curl 'https://tps.ideea.io/api/v1/items/12420628-7d15-4a2b-91fb-af8e27c4943f/' \
  -X GET \
  -H 'Authorization: Bearer ACCESS_TOKEN'

Response

[
  {
    "id": "09a35d4b-2432-419e-81a2-253538b1bbae",
    "group_id": "12420628-7d15-4a2b-91fb-af8e27c4943f",
  },
  ...
]

To get an array of all of the buckets owned by a group. Use the .getBuckets(GroupID) method.

HTTP Endpoint

GET http://tps.ideea.io/api/v1/item/{item_id}/

Update an Item

POST - /items/{item_id}/update

tps
  .updateItem('09a35d4b-2432-419e-81a2-253538b1bbae', 'group_id', is_public)
  .then(item => {
    console.log(item);
  });
<?php

$item = $tps->updateItem('09a35d4b-2432-419e-81a2-253538b1bbae', 'new_group_id', $is_public);

echo $item;
curl 'https://tps.ideea.io/api/v1/items/09a35d4b-2432-419e-81a2-253538b1bbae' \
  -X POST \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json;' \
  --data-binary '{"item_id":"my-unique-item-id", "group_id":"my-unique-group-id", "is_public":true}'```

> Response

```json
{
  "id": "my-unique-item-id",
  "group_id": "my-unique-new-group-id",
  "name": "my-unique-bucket-name",
},

Deletes an item

HTTP Endpoint

DELETE http://tps.ideea.io/api/v1/items/{bucket_id}/update

Delete An Item

DELETE - /item/{item_id}/delete

tps.deleteItem('09a35d4b-2432-419e-81a2-253538b1bbae').then(item => {
  console.log(item);
});
<?php

$deleteItem = $tps->deleteItem('09a35d4b-2432-419e-81a2-253538b1bbae');

echo $deletedItem->id;
curl 'https://tps.ideea.io/api/v1/item/09a35d4b-2432-419e-81a2-253538b1bbae/delete' \
  -X DELETE \
  -H 'Authorization: Bearer ACCESS_TOKEN'

Response

{
  "id": "709ee024-bf38-4a08-a4f6-1f20178ef1ba"
}

To delete an item make DELETE request to /items/{item_id}/delete.

HTTP Endpoint

POST http://tps.ideea.io/api/v1/jobs/create

Jobs

Create Job

POST - https://tps.ideea.io/tps/jobs/create/

const TPS = require('tps');
<?php

$job = $tps->createJob("09a35d4b-2432-419e-81a2-253538b1bbae");

echo $job;
curl https://tps.ideea.io/scape/api/v1/jobs/create \
  -X POST \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  --data-binary '{"job_id":"my-unique-job-id", "group_id":"my-unique-group-id"}'```

Response

{
  "id": "my-unique-job-id",
  "group_id": "my-unique-group-id",
  "created_at": "2019-03-02 20:33:13"
}

To create a new job make a post request to /jobs/create. This will create the job with the provided data.

HTTP Endpoint

POST https://tps.ideea.io/api/v1/jobs/create

Get Job

GET /job/{job_id}

tps.getJob('09a35d4b-2432-419e-81a2-253538b1bbae').then(job => {
  console.log(job);
});
<?php

$job = $tps->getJob('09a35d4b-2432-419e-81a2-253538b1bbae');

echo $job
curl 'https://tps.ideea.io/api/v1/jobs/09a35d4b-2432-419e-81a2-253538b1bbae' \
  -X GET \
  -H 'Authorization: Bearer ACCESS_TOKEN'

Response

[
  {
    "id": "0738a0bb-c36c-4c2e-af6e-756d6d0c41d1",
    "group_id": "00000000-9a34-4466-ba4c-46438def7d7f",
    "created_at": "2019-03-02 20:33:13"
  }
  ...
]

HTTP Endpoint

GET http://tps.ideea.io/api/v1/jobs/{job_id}

Get Group

GET - /groups/{group_id}/jobs

tps.getGroup('09a35d4b-2432-419e-81a2-253538b1bbae').then(group => {
  for (job of group) {
    console.log(job);
  }
});
<?php

$group = $tps->getGroup('09a35d4b-2432-419e-81a2-253538b1bbae');

echo $group
curl 'https://tps.ideea.io/api/v1/groups/09a35d4b-2432-419e-81a2-253538b1bbae/jobs' \
  -X GET \
  -H 'Authorization: Bearer ACCESS_TOKEN'

Response

{
  "id": "0738a0bb-c36c-4c2e-af6e-756d6d0c41d1",
  "group_id": "00000000-9a34-4466-ba4c-46438def7d7f",
  "created_at": "2019-03-02 20:33:13"
}

HTTP Endpoint

GET http://tps.ideea.io/api/v1/groups/{group_id}/jobs

Errors

The Ideea API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.