Skip to content

Latest commit

 

History

History
115 lines (92 loc) · 2.52 KB

CALLBACK.md

File metadata and controls

115 lines (92 loc) · 2.52 KB

Callback

Callback used to retrieve an information for Uiza to your server, so you can have a trigger notice about an entity is upload completed .

See details here.

Create a callback

This API will allow you setup a callback to your server when an entity is completed for upload or public See details here.

const uiza = require('uiza');
uiza.authorization('your-authorization-key');
uiza.app_id('your-app-id');

/** create */
const params = {
  'url': 'https://callback-url.uiza.co',
  'method': 'POST'
};

uiza.callback.create(params).then((res) => {
  //Identifier of callback has been created
}).catch((err) => {
  //Error
});

Example Response

{  "id": "8b83886e-9cc3-4eab-9258-ebb16c0c73de" }

Retrieve a callback

Retrieves the details of an existing callback. See details here.

const uiza = require('uiza')('your-authorization');
uiza.app_id('your-app-id');

uiza.callback.retrieve().then((res) => {
  //Identifier of callback has been retrieved
}).catch((err) => {
  //Error
});

Example Response

{  
  "id": "0a6bf245-1cce-494f-a193-b5a44aa05558",
  "url": "https://callback-url.uiza.co",
  "headersData": null,
  "jsonData": {
    "text": "example callback"
  },
  "method": "POST",
  "status": 1,
  "createdAt": "2018-06-23T01:27:08.000Z",
  "updatedAt": "2018-06-23T01:27:08.000Z" 
}

Update a callback

This API will allow you setup a callback to your server when an entity is completed for upload or public See details here.

const uiza = require('uiza')('your-authorization');
uiza.app_id('your-app-id');

const params = {
  'id': '1b1f97f9-9afd-46d1-a2e1-f3b3896374df',
  'url': 'https://callback-url.uiza.co',
  'method': 'GET'
} 
uiza.callback.update(params).then((res) => {
  //Identifier of callback has been updated
}).catch((err) => {
  //Error
});

Example Response

{  "id": "8b83886e-9cc3-4eab-9258-ebb16c0c73de" }

Delete a callback

Retrieves the details of an existing callback. See details here.

const uiza = require('uiza')('your-authorization');
uiza.app_id('your-app-id');

const params = {
  id: '1b1f97f9-9afd-46d1-a2e1-f3b3896374df'
};

uiza.callback.delete(params).then((res) => {
  //Identifier of callback has been deleted
}).catch((err) => {
  //Error
});

Example Response

{  "id": "8b83886e-9cc3-4eab-9258-ebb16c0c73de" }