Rest API

Requirements

Our api needs the following requirements

myAuth : Unique and non-transferable token for authenticate requests

myCorporateToken : Unique and non-transferable token to make requests to our resources

HOST : Will be provided by Imbee

All requests must use the header "Content-Type" with value "application/json"

All requests to our API have the same response format, which is composed of the following properties:

time: time spent generating a response.

code: The generic codes are 1 if an error was detected while processing your request, or 0 if your request could be processed. There may be more error codes that will be detailed in each web services if they exist.

message: descriptive message of the webservice, it is not relevant.

body: The answer itself of the request made.

{
    "time": 0.00019,
    "code": 0,
    "message": "Ok",
    "body": {
        "data0": "value0",
        "data1": "value1"
    }
}

Generate a Access Token

Create a new web access token from a unique identifier

params:

virutal_user: can not be null or empty

bot_idsha: unique and non-transferable bot identifier

mail: address to send a mail with the access token (optional*)

celullar: celullar to send a sms with the access token (optional*)

max_retries: amount of retries that a user can use the access token (optional, if not specified, the default limit will be set)

date_limit: date that a access token will be valid, date format YYYY-MM-DD (optional, if not specified, the default limit will be set)

Notes:

mail or celullar can be optional, but not both at the same time

Request:

curl --request POST --url https://HOST/token/new --header 'Authorization: myAuth' --header 'Content-Type: application/json' --header 'X-WOOS-KEY: myCorporateToken' --data '{"virtual_user":"user_identifier_sha", "bot_idsha":"bot_identifier", "mail":"user_email", "celullar":"user_phone", "max_retries": 10, "date_limit": "2018-12-31"}'

If no date_limit or max_retries

Response:

{
    "time": 0.00019,
    "code": 0,
    "message": "Ok",
    "body": {
        "url": "url_with_token",
        "user_idsha": "idsha_value",
        "date_limit": "2000-01-01",
        "max_retries": 10,
        "previously_created": false
    }
}

Create a External User

Creating a new user from a unique identifier

Request:

curl --request POST --url https://HOST/third_parties/user/new --header 'Authorization: myAuth' --header 'Content-Type: application/json' --header 'X-WOOS-KEY: myCorporateToken' --data '{"uniqueIdSha":"user_identifier_sha", "platform": "platformValue","deviceName": "deviceNameValue","hardwareId":"hardwareIdValue","osVersion":"osVersionValue"}'

Response:

{
    "time": 0.01809,
    "code": 0,
    "message": "Ok",
    "body": {
        "virtualUser": "idShaValue_user1",
        "pass": "pass_user1",
        "apikey": "apikey_user1",
        "previously_registered": false
    }
}

Create a Chat between users

Request:

curl --request POST --url http://HOST/chat/create --header 'Authorization: myAuth' --header 'Content-Type: application/json' --header 'X-WOOS-KEY: apikey_user1' --data '{"type":"chat", "contacts":[{"idsha":"idShaValue_user2"}]}'

Response:

{
  "body": {
    "contacts": [
    {
      "idsha": "idShaValue_user1",
      "isadmin": 1
    },
    {
      "idsha": "idShaValue_user2",
      "isadmin": 0
    }
    ],
    "conversationId": "conversation_identifier",
    "previously_created": false
  },
  "code": 0,
  "message": "Ok.",
  "time": 0
}

Last updated