Jido-T63 Developer's Portal

Introduction

 

For development of applications, please use the resources that can guide and facilitate depending on your requirements:

1. You can use the Communication Protocols listed in the document of Sxtreo T63 (Jido) to the user so that the developers can develop their own application, or can integrate with your application.

2. Users can use the SDK in their Mobile App to consume all the methods as and when required. when the data consumption will be done the user can transfer those collected data to our server using the Web APIs provided by us.

3. In the case of BLE Gateway, users can assess the collected data from the server using the web API provided by us to the Mobile App being developed.

The detail of those above-mentioned points are briefed clearly in the next tabs.

 

Protocol Doc

 

Manual Lock and E-Lock GPS Container
Version 1.2

View Protocol Doc

Authentication

 

To get started using Jido's API platform, you'll need a valid API key. All authenticated API requests should have a header token. The API token can be generated by using API user’s credentials (i.e. Valid API Username & Password). If you're a current customer and don't have an API user’s credentials, please contact support. A sample snippet of the code across various platforms are given below:

 

    curl "http://182.18.139.139/jido/index.php/api/datasync/login" \
    -X POST \
    -d "username=admin&password=sil123" \
    -H "Content-Type: application/x-www-form-urlencoded"
    POST /jido/index.php/api/datasync/login HTTP/1.1
    Host: 182.18.139.139:80
    Content-Type: application/x-www-form-urlencoded
    username=admin&password=sil123
    const headers = new Headers();
    headers.append('Content-Type', 'application/x-www-form-urlencoded');

    const body = `username=admin&password=sil123`;

    const init = {
      method: 'POST',
      headers,
      body
    };

    fetch('http://182.18.139.139/jido/index.php/api/datasync/login', init)
    .then((response) => {
      return response.json(); // or .text() or .blob() ...
    })
    .then((text) => {
      // text is the response body
    })
    .catch((e) => {
      // error in e.message
    });
    (async () => {
      const headers = new Headers();
      headers.append('Content-Type', 'application/x-www-form-urlencoded');

      const body = `username=admin&password=sil123`;

      const init = {
        method: 'POST',
        headers,
        body
      };

      const response = await fetch('http://182.18.139.139/jido/index.php/api/datasync/login', init);
      console.log(`response status is ${response.status}`);
      const mediaType = response.headers.get('content-type');
      let data;
      if (mediaType.includes('json')) {
        data = await response.json();
      } else {
        data = await response.text();
      }
      console.log(data);
    })();
    const http = require('http');
    const init = {
      host: '182.18.139.139',
      path: '/jido/index.php/api/datasync/login',
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    };
    const callback = function(response) {
      let result = Buffer.alloc(0);
      response.on('data', function(chunk) {
        result = Buffer.concat([result, chunk]);
      });
      
      response.on('end', function() {
        // result has response body buffer
        console.log(result.toString());
      });
    };

    const req = http.request(init, callback);
    const body = `username=admin&password=sil123`;
    req.write(body);
    req.end();
    var xhr = new XMLHttpRequest();
    xhr.addEventListener('load', function(e) {
      var response = e.target.responseText;
      console.log(response);
    });
    xhr.addEventListener('error', function(e) {
      console.error('Request errored with status', e.target.status);
    });
    xhr.open('POST', 'http://182.18.139.139/jido/index.php/api/datasync/login');
    xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    var body = '';
    body += 'username=admin&password=sil123';
    xhr.send(body);
    import requests

    url = 'http://182.18.139.139/jido/index.php/api/datasync/login'
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """username=admin&password=sil123"""

    req = requests.post(url, headers=headers, data=body)

    print(req.status_code)
    print(req.headers)
    print(req.text)
    import httplib

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """username=admin&password=sil123"""

    conn = httplib.HTTPConnection('182.18.139.139')
    conn.request('POST','/jido/index.php/api/datasync/login', body, headers)
    res = conn.getresponse()

    print(res.status, res.reason)
    print(res.read())
    print(res.getheaders())
    import http.client

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """username=admin&password=sil123"""

    conn = http.client.HTTPConnection('182.18.139.139')
    conn.request('POST','/jido/index.php/api/datasync/login', body, headers)
    res = conn.getresponse()

    data = res.read()
    print(res.status, res.reason)
    print(data.decode('utf-8'))
    print(res.getheaders())
    var xhr = new XMLHttpRequest();
    xhr.addEventListener('load', function(e) {
      var response = e.target.responseText;
      console.log(response);
    });
    xhr.addEventListener('error', function(e) {
      console.error('Request errored with status', e.target.status);
    });
    xhr.open('POST', 'http://182.18.139.139/jido/index.php/api/datasync/login');
    xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    var body = '';
    body += 'username=admin&password=sil123';
    xhr.send(body);
    #include 
    #include 

    int main(void)
    {
        CURL *curl;
        CURLcode res;

        curl = curl_easy_init();
        curl_easy_setopt(curl, CURLOPT_URL, "http://182.18.139.139/jido/index.php/api/datasync/login");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
        /* if redirected, tell libcurl to follow redirection */
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

        struct curl_slist *headers = NULL;
        headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

        char *body ="username=admin&password=sil123";
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body);

        /* Perform the request, res will get the return code */
        res = curl_easy_perform(curl);
        if (res != CURLE_OK) {
            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
        }
        /* Clean up after yourself */
        curl_easy_cleanup(curl);
        return 0;
    }
    /* See: http://stackoverflow.com/a/2329792/1127848 of how to read data from the response. */
    URL url = new URL("http://182.18.139.139/jido/index.php/api/datasync/login");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("POST");
    con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

    /* Payload support */
    con.setDoOutput(true);
    DataOutputStream out = new DataOutputStream(con.getOutputStream());
    out.writeBytes("username=admin&password=sil123");
    out.flush();
    out.close();

    int status = con.getResponseCode();
    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer content = new StringBuffer();
    while((inputLine = in.readLine()) != null) {
        content.append(inputLine);
    }
    in.close();
    con.disconnect();
    System.out.println("Response status: " + status);
    System.out.println(content.toString());
    RestTemplate rest = new RestTemplate();
    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", "application/x-www-form-urlencoded");

    StringBuilder sb = new StringBuilder();
    sb.append("username=admin&password=sil123");
    String body = sb.toString();

    HttpEntity requestEntity = new HttpEntity(body, headers);
    ResponseEntity responseEntity = rest.exchange("http://182.18.139.139/jido/index.php/api/datasync/login", HttpMethod.POST, requestEntity, String.class);
    HttpStatus httpStatus = responseEntity.getStatusCode();
    int status = httpStatus.value();
    String response = responseEntity.getBody();
    System.out.println("Response status: " + status);
    System.out.println(response);

Get Current Positional Data

 

To get the latest positional information of an object, you’ll need to pass the corresponding object’s ‘serial no’ and ‘Authenticated token’ as API request parameters. API will return the latest positional information along with its latitude & longitude as an output. A sample snippet of the code across various platforms are given below:

 

    curl "http://182.18.139.139/jido/index.php/api/datasync/getlastpositionaldata" \
      -X POST \
      -d "serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo" \
      -H "Content-Type: application/x-www-form-urlencoded"
    POST /jido/index.php/api/datasync/getlastpositionaldata HTTP/1.1
    Host: 182.18.139.139:80
    Content-Type: application/x-www-form-urlencoded

    serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo
    const headers = new Headers();
    headers.append('Content-Type', 'application/x-www-form-urlencoded');

    const body = `serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo`;

    const init = {
      method: 'POST',
      headers,
      body
    };

    fetch('http://182.18.139.139/jido/index.php/api/datasync/getlastpositionaldata', init)
    .then((response) => {
      return response.json(); // or .text() or .blob() ...
    })
    .then((text) => {
      // text is the response body
    })
    .catch((e) => {
      // error in e.message
    });
    (async () => {
      const headers = new Headers();
      headers.append('Content-Type', 'application/x-www-form-urlencoded');

      const body = `serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo`;

      const init = {
        method: 'POST',
        headers,
        body
      };

      const response = await fetch('http://182.18.139.139/jido/index.php/api/datasync/getlastpositionaldata', init);
      console.log(`response status is ${response.status}`);
      const mediaType = response.headers.get('content-type');
      let data;
      if (mediaType.includes('json')) {
        data = await response.json();
      } else {
        data = await response.text();
      }
      console.log(data);
    })();
    const http = require('http');
    const init = {
      host: '182.18.139.139',
      path: '/jido/index.php/api/datasync/getlastpositionaldata',
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    };
    const callback = function(response) {
      let result = Buffer.alloc(0);
      response.on('data', function(chunk) {
        result = Buffer.concat([result, chunk]);
      });
      
      response.on('end', function() {
        // result has response body buffer
        console.log(result.toString());
      });
    };

    const req = http.request(init, callback);
    const body = `serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo`;
    req.write(body);
    req.end();
    var xhr = new XMLHttpRequest();
    xhr.addEventListener('load', function(e) {
      var response = e.target.responseText;
      console.log(response);
    });
    xhr.addEventListener('error', function(e) {
      console.error('Request errored with status', e.target.status);
    });
    xhr.open('POST', 'http://182.18.139.139/jido/index.php/api/datasync/getlastpositionaldata');
    xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    var body = '';
    body += 'serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo';
    xhr.send(body);
    import requests

    url = 'http://182.18.139.139/jido/index.php/api/datasync/getlastpositionaldata'
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo"""

    req = requests.post(url, headers=headers, data=body)

    print(req.status_code)
    print(req.headers)
    print(req.text)
    import httplib

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo"""

    conn = httplib.HTTPConnection('182.18.139.139')
    conn.request('POST','/jido/index.php/api/datasync/getlastpositionaldata', body, headers)
    res = conn.getresponse()

    print(res.status, res.reason)
    print(res.read())
    print(res.getheaders())
    import http.client

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo"""

    conn = http.client.HTTPConnection('182.18.139.139')
    conn.request('POST','/jido/index.php/api/datasync/getlastpositionaldata', body, headers)
    res = conn.getresponse()

    data = res.read()
    print(res.status, res.reason)
    print(data.decode('utf-8'))
    print(res.getheaders())
    #include 
    #include 

    int main(void)
    {
        CURL *curl;
        CURLcode res;

        curl = curl_easy_init();
        curl_easy_setopt(curl, CURLOPT_URL, "http://182.18.139.139/jido/index.php/api/datasync/getlastpositionaldata");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
        /* if redirected, tell libcurl to follow redirection */
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

        struct curl_slist *headers = NULL;
        headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

        char *body ="serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo";
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body);

        /* Perform the request, res will get the return code */
        res = curl_easy_perform(curl);
        if (res != CURLE_OK) {
            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
        }
        /* Clean up after yourself */
        curl_easy_cleanup(curl);
        return 0;
    }
    /* See: http://stackoverflow.com/a/2329792/1127848 of how to read data from the response. */
    URL url = new URL("http://182.18.139.139/jido/index.php/api/datasync/getlastpositionaldata");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("POST");
    con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

    /* Payload support */
    con.setDoOutput(true);
    DataOutputStream out = new DataOutputStream(con.getOutputStream());
    out.writeBytes("serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo");
    out.flush();
    out.close();

    int status = con.getResponseCode();
    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer content = new StringBuffer();
    while((inputLine = in.readLine()) != null) {
        content.append(inputLine);
    }
    in.close();
    con.disconnect();
    System.out.println("Response status: " + status);
    System.out.println(content.toString());
    RestTemplate rest = new RestTemplate();
    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", "application/x-www-form-urlencoded");

    StringBuilder sb = new StringBuilder();
    sb.append("serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo");
    String body = sb.toString();

    HttpEntity requestEntity = new HttpEntity(body, headers);
    ResponseEntity responseEntity = rest.exchange("http://182.18.139.139/jido/index.php/api/datasync/getlastpositionaldata", HttpMethod.POST, requestEntity, String.class);
    HttpStatus httpStatus = responseEntity.getStatusCode();
    int status = httpStatus.value();
    String response = responseEntity.getBody();
    System.out.println("Response status: " + status);
    System.out.println(response);

Get Positional Log Data

 

To get historical data of an object using Jido's API platform, you’ll need to send the corresponding object’s ‘serial no’, ‘Log date’ (i.e. a date for which you want to retrieve the device’s data along with positional information), ‘Authenticated token’. API will return the device’s data of the provided log date. A sample snippet of the code across various platforms are given below:

 

    curl "http://182.18.139.139/jido/index.php/api/datasync/getpositionallogdata" \
      -X POST \
      -d "serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15" \
      -H "Content-Type: application/x-www-form-urlencoded"
    POST /jido/index.php/api/datasync/getpositionallogdata HTTP/1.1
    Host: 182.18.139.139:80
    Content-Type: application/x-www-form-urlencoded

    serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15
    const headers = new Headers();
    headers.append('Content-Type', 'application/x-www-form-urlencoded');

    const body = `serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15`;

    const init = {
      method: 'POST',
      headers,
      body
    };

    fetch('http://182.18.139.139/jido/index.php/api/datasync/getpositionallogdata', init)
    .then((response) => {
      return response.json(); // or .text() or .blob() ...
    })
    .then((text) => {
      // text is the response body
    })
    .catch((e) => {
      // error in e.message
    });
    (async () => {
      const headers = new Headers();
      headers.append('Content-Type', 'application/x-www-form-urlencoded');

      const body = `serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15`;

      const init = {
        method: 'POST',
        headers,
        body
      };

      const response = await fetch('http://182.18.139.139/jido/index.php/api/datasync/getpositionallogdata', init);
      console.log(`response status is ${response.status}`);
      const mediaType = response.headers.get('content-type');
      let data;
      if (mediaType.includes('json')) {
        data = await response.json();
      } else {
        data = await response.text();
      }
      console.log(data);
    })();
    const http = require('http');
    const init = {
      host: '182.18.139.139',
      path: '/jido/index.php/api/datasync/getpositionallogdata',
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    };
    const callback = function(response) {
      let result = Buffer.alloc(0);
      response.on('data', function(chunk) {
        result = Buffer.concat([result, chunk]);
      });
      
      response.on('end', function() {
        // result has response body buffer
        console.log(result.toString());
      });
    };

    const req = http.request(init, callback);
    const body = `serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15`;
    req.write(body);
    req.end();

    var xhr = new XMLHttpRequest();
    xhr.addEventListener('load', function(e) {
      var response = e.target.responseText;
      console.log(response);
    });
    xhr.addEventListener('error', function(e) {
      console.error('Request errored with status', e.target.status);
    });
    xhr.open('POST', 'http://182.18.139.139/jido/index.php/api/datasync/getpositionallogdata');
    xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    var body = '';
    body += 'serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15';
    xhr.send(body);

    import requests

    url = 'http://182.18.139.139/jido/index.php/api/datasync/getpositionallogdata'
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15"""

    req = requests.post(url, headers=headers, data=body)

    print(req.status_code)
    print(req.headers)
    print(req.text)
    import httplib

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15"""

    conn = httplib.HTTPConnection('182.18.139.139')
    conn.request('POST','/jido/index.php/api/datasync/getpositionallogdata', body, headers)
    res = conn.getresponse()

    print(res.status, res.reason)
    print(res.read())
    print(res.getheaders())
    import http.client

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15"""

    conn = http.client.HTTPConnection('182.18.139.139')
    conn.request('POST','/jido/index.php/api/datasync/getpositionallogdata', body, headers)
    res = conn.getresponse()

    data = res.read()
    print(res.status, res.reason)
    print(data.decode('utf-8'))
    print(res.getheaders())
    #include 
    #include 

    int main(void)
    {
        CURL *curl;
        CURLcode res;

        curl = curl_easy_init();
        curl_easy_setopt(curl, CURLOPT_URL, "http://182.18.139.139/jido/index.php/api/datasync/getpositionallogdata");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
        /* if redirected, tell libcurl to follow redirection */
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

        struct curl_slist *headers = NULL;
        headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

        char *body ="serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15";
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body);

        /* Perform the request, res will get the return code */
        res = curl_easy_perform(curl);
        if (res != CURLE_OK) {
            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
        }
        /* Clean up after yourself */
        curl_easy_cleanup(curl);
        return 0;
    }
    /* See: http://stackoverflow.com/a/2329792/1127848 of how to read data from the response. */
    URL url = new URL("http://182.18.139.139/jido/index.php/api/datasync/getpositionallogdata");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("POST");
    con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

    /* Payload support */
    con.setDoOutput(true);
    DataOutputStream out = new DataOutputStream(con.getOutputStream());
    out.writeBytes("serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15");
    out.flush();
    out.close();

    int status = con.getResponseCode();
    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer content = new StringBuffer();
    while((inputLine = in.readLine()) != null) {
        content.append(inputLine);
    }
    in.close();
    con.disconnect();
    System.out.println("Response status: " + status);
    System.out.println(content.toString());
    RestTemplate rest = new RestTemplate();
    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", "application/x-www-form-urlencoded");

    StringBuilder sb = new StringBuilder();
    sb.append("serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15");
    String body = sb.toString();

    HttpEntity requestEntity = new HttpEntity(body, headers);
    ResponseEntity responseEntity = rest.exchange("http://182.18.139.139/jido/index.php/api/datasync/getpositionallogdata", HttpMethod.POST, requestEntity, String.class);
    HttpStatus httpStatus = responseEntity.getStatusCode();
    int status = httpStatus.value();
    String response = responseEntity.getBody();
    System.out.println("Response status: " + status);
    System.out.println(response);

Get Alert Details

 

This API returns all alert types in the Jido's API platform. you’ll need to send the Authenticated token’ as a GET parameter. A sample snippet of the code across various platforms are given below:

 

    curl "http://182.18.139.139/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo" \
  -d "serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15" \
  -H "Content-Type: application/x-www-form-urlencoded"
    GET /jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo HTTP/1.1
    Host: 182.18.139.139:80
    Content-Type: application/x-www-form-urlencoded

    serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15
    const headers = new Headers();
    headers.append('Content-Type', 'application/x-www-form-urlencoded');

    const body = `serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15`;

    const init = {
      method: 'GET',
      headers,
      body
    };

    fetch('http://182.18.139.139/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo', init)
    .then((response) => {
      return response.json(); // or .text() or .blob() ...
    })
    .then((text) => {
      // text is the response body
    })
    .catch((e) => {
      // error in e.message
    });
    (async () => {
      const headers = new Headers();
      headers.append('Content-Type', 'application/x-www-form-urlencoded');

      const body = `serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15`;

      const init = {
        method: 'GET',
        headers,
        body
      };

      const response = await fetch('http://182.18.139.139/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo', init);
      console.log(`response status is ${response.status}`);
      const mediaType = response.headers.get('content-type');
      let data;
      if (mediaType.includes('json')) {
        data = await response.json();
      } else {
        data = await response.text();
      }
      console.log(data);
    })();
    const http = require('http');
    const init = {
      host: '182.18.139.139',
      path: '/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo',
      method: 'GET',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    };
    const callback = function(response) {
      let result = Buffer.alloc(0);
      response.on('data', function(chunk) {
        result = Buffer.concat([result, chunk]);
      });
      
      response.on('end', function() {
        // result has response body buffer
        console.log(result.toString());
      });
    };

    const req = http.request(init, callback);
    const body = `serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15`;
    req.write(body);
    req.end();
    var xhr = new XMLHttpRequest();
    xhr.addEventListener('load', function(e) {
      var response = e.target.responseText;
      console.log(response);
    });
    xhr.addEventListener('error', function(e) {
      console.error('Request errored with status', e.target.status);
    });
    xhr.open('GET', 'http://182.18.139.139/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo');
    xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    var body = '';
    body += 'serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15';
    xhr.send(body);

    import requests

    url = 'http://182.18.139.139/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo'
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15"""

    req = requests.get(url, headers=headers, data=body)

    print(req.status_code)
    print(req.headers)
    print(req.text)
    import httplib

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15"""

    conn = httplib.HTTPConnection('182.18.139.139')
    conn.request('GET','/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo', body, headers)
    res = conn.getresponse()

    print(res.status, res.reason)
    print(res.read())
    print(res.getheaders())
    import http.client

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15"""

    conn = http.client.HTTPConnection('182.18.139.139')
    conn.request('GET','/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo', body, headers)
    res = conn.getresponse()

    data = res.read()
    print(res.status, res.reason)
    print(data.decode('utf-8'))
    print(res.getheaders())
    #include 
    #include 

    int main(void)
    {
        CURL *curl;
        CURLcode res;

        curl = curl_easy_init();
        curl_easy_setopt(curl, CURLOPT_URL, "http://182.18.139.139/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
        /* if redirected, tell libcurl to follow redirection */
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

        struct curl_slist *headers = NULL;
        headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

        char *body ="serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15";
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body);

        /* Perform the request, res will get the return code */
        res = curl_easy_perform(curl);
        if (res != CURLE_OK) {
            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
        }
        /* Clean up after yourself */
        curl_easy_cleanup(curl);
        return 0;
    }
    /* See: http://stackoverflow.com/a/2329792/1127848 of how to read data from the response. */
    URL url = new URL("http://182.18.139.139/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("GET");
    con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

    /* Payload support */
    con.setDoOutput(true);
    DataOutputStream out = new DataOutputStream(con.getOutputStream());
    out.writeBytes("serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15");
    out.flush();
    out.close();

    int status = con.getResponseCode();
    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer content = new StringBuffer();
    while((inputLine = in.readLine()) != null) {
        content.append(inputLine);
    }
    in.close();
    con.disconnect();
    System.out.println("Response status: " + status);
    System.out.println(content.toString());
    RestTemplate rest = new RestTemplate();
    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", "application/x-www-form-urlencoded");

    StringBuilder sb = new StringBuilder();
    sb.append("serial_no=X630000000000122&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&log_date=2021-04-15");
    String body = sb.toString();

    HttpEntity requestEntity = new HttpEntity(body, headers);
    ResponseEntity responseEntity = rest.exchange("http://182.18.139.139/jido/index.php/api/datasync/getalerttypes?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo", HttpMethod.GET, requestEntity, String.class);
    HttpStatus httpStatus = responseEntity.getStatusCode();
    int status = httpStatus.value();
    String response = responseEntity.getBody();
    System.out.println("Response status: " + status);
    System.out.println(response);

Get Jido Alerts Data

 

To get historical alert data of an object using Jido's API platform, you’ll need to send the corresponding object’s ‘serial no’, ‘Alert date’ (i.e. a date for which you want to retrieve the device’s alert data), ‘Alert type’, ‘Authenticated token’. API will return the device’s alert data of the given alert date. A sample snippet of the code across various platforms are given below:

 

    curl "http://182.18.139.139/jido/index.php/api/datasync/getdevicealertdata" \
      -X POST \
      -d "alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122" \
      -H "Content-Type: application/x-www-form-urlencoded"
    POST /jido/index.php/api/datasync/getdevicealertdata HTTP/1.1
    Host: 182.18.139.139:80
    Content-Type: application/x-www-form-urlencoded

    alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122
    const headers = new Headers();
    headers.append('Content-Type', 'application/x-www-form-urlencoded');

    const body = `alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122`;

    const init = {
      method: 'POST',
      headers,
      body
    };

    fetch('http://182.18.139.139/jido/index.php/api/datasync/getdevicealertdata', init)
    .then((response) => {
      return response.json(); // or .text() or .blob() ...
    })
    .then((text) => {
      // text is the response body
    })
    .catch((e) => {
      // error in e.message
    });
    (async () => {
      const headers = new Headers();
      headers.append('Content-Type', 'application/x-www-form-urlencoded');

      const body = `alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122`;

      const init = {
        method: 'POST',
        headers,
        body
      };

      const response = await fetch('http://182.18.139.139/jido/index.php/api/datasync/getdevicealertdata', init);
      console.log(`response status is ${response.status}`);
      const mediaType = response.headers.get('content-type');
      let data;
      if (mediaType.includes('json')) {
        data = await response.json();
      } else {
        data = await response.text();
      }
      console.log(data);
    })();
    const http = require('http');
    const init = {
      host: '182.18.139.139',
      path: '/jido/index.php/api/datasync/getdevicealertdata',
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    };
    const callback = function(response) {
      let result = Buffer.alloc(0);
      response.on('data', function(chunk) {
        result = Buffer.concat([result, chunk]);
      });
      
      response.on('end', function() {
        // result has response body buffer
        console.log(result.toString());
      });
    };

    const req = http.request(init, callback);
    const body = `alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122`;
    req.write(body);
    req.end();

    var xhr = new XMLHttpRequest();
    xhr.addEventListener('load', function(e) {
      var response = e.target.responseText;
      console.log(response);
    });
    xhr.addEventListener('error', function(e) {
      console.error('Request errored with status', e.target.status);
    });
    xhr.open('POST', 'http://182.18.139.139/jido/index.php/api/datasync/getdevicealertdata');
    xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    var body = '';
    body += 'alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122';
    xhr.send(body);
    import requests

    url = 'http://182.18.139.139/jido/index.php/api/datasync/getdevicealertdata'
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122"""

    req = requests.post(url, headers=headers, data=body)

    print(req.status_code)
    print(req.headers)
    print(req.text)
    import httplib

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122"""

    conn = httplib.HTTPConnection('182.18.139.139')
    conn.request('POST','/jido/index.php/api/datasync/getdevicealertdata', body, headers)
    res = conn.getresponse()

    print(res.status, res.reason)
    print(res.read())
    print(res.getheaders())
    import http.client

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    body = """alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122"""

    conn = http.client.HTTPConnection('182.18.139.139')
    conn.request('POST','/jido/index.php/api/datasync/getdevicealertdata', body, headers)
    res = conn.getresponse()

    data = res.read()
    print(res.status, res.reason)
    print(data.decode('utf-8'))
    print(res.getheaders())
    #include 
    #include 

    int main(void)
    {
        CURL *curl;
        CURLcode res;

        curl = curl_easy_init();
        curl_easy_setopt(curl, CURLOPT_URL, "http://182.18.139.139/jido/index.php/api/datasync/getdevicealertdata");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
        /* if redirected, tell libcurl to follow redirection */
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

        struct curl_slist *headers = NULL;
        headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

        char *body ="alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122";
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body);

        /* Perform the request, res will get the return code */
        res = curl_easy_perform(curl);
        if (res != CURLE_OK) {
            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
        }
        /* Clean up after yourself */
        curl_easy_cleanup(curl);
        return 0;
    }
    /* See: http://stackoverflow.com/a/2329792/1127848 of how to read data from the response. */
    URL url = new URL("http://182.18.139.139/jido/index.php/api/datasync/getdevicealertdata");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("POST");
    con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

    /* Payload support */
    con.setDoOutput(true);
    DataOutputStream out = new DataOutputStream(con.getOutputStream());
    out.writeBytes("alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122");
    out.flush();
    out.close();

    int status = con.getResponseCode();
    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer content = new StringBuffer();
    while((inputLine = in.readLine()) != null) {
        content.append(inputLine);
    }
    in.close();
    con.disconnect();
    System.out.println("Response status: " + status);
    System.out.println(content.toString());
    RestTemplate rest = new RestTemplate();
    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", "application/x-www-form-urlencoded");

    StringBuilder sb = new StringBuilder();
    sb.append("alert_id=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsImFwaV91c2VyX2lkIjoiMSIsImlzX2xvZ2dlZF9pbiI6dHJ1ZX0.Q15N4mtgpazPtRJ7x_9ZlfF1ecsUSa8fkSvKWLVRzpo&alert_date=2021-04-15&serial_no=X630000000000122");
    String body = sb.toString();

    HttpEntity requestEntity = new HttpEntity(body, headers);
    ResponseEntity responseEntity = rest.exchange("http://182.18.139.139/jido/index.php/api/datasync/getdevicealertdata", HttpMethod.POST, requestEntity, String.class);
    HttpStatus httpStatus = responseEntity.getStatusCode();
    int status = httpStatus.value();
    String response = responseEntity.getBody();
    System.out.println("Response status: " + status);
    System.out.println(response);

 

Technical Support Center

Click Here

 

Integration Manual

 

Integration Manual Document
Version 1.1

View Manual Doc

 

For any technical support email us at: techsupport@sxtreo.com

 

User Manual

 

User Manual Document
Version 2.2

View User Manual

Let's Get In Touch!


Ready to start your next project with us?
That's great! Give us a call or send us an email and we will get back to you as soon as possible!

Black Box Network Services India Pvt. Ltd.

+91 990 309 1725 / +91 907 392 9780

Copyright © 2024 Sxtreo. All Rights Reserved.