Skip to content

Alternative library to access Antares HTTP API without causing CORS issue

Notifications You must be signed in to change notification settings

fahmij8/antares-bypasser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Antares HTTP API CORS Bypasser

Alternative library to access Antares HTTP API without causing CORS issue. To use this, you need jQuery library.

Features

Features Availability
Bypass CORS
MQTT notify on POST
Dynamic Usage ❎ , MQTT notify always on

API Reference

GET data

  POST /get-data.php
Parameter Type Description
endpoint string Required. Device URL + /la
accesskey string Required. Personal antares Access Key

POST data

  POST /post-data.php
Parameter Type Description
data string Required. Payload for Antares Device
endpoint string Required. Device URL + /la
accesskey string Required. Personal antares Access Key

Usage/Examples

GET data

$.ajax({
    url: "https://antares-gp.herokuapp.com/get-data.php",
    method: "POST",
    crossDomain: true,
    data: { 
        endpoint: "https://platform.antares.id:8443/~/antares-cse/antares-id/tesMQTT/esp32/la",
        accesskey: "Your Access Key" 
    },
    success: (res) => {
        console.log("Success : ", res);
    },
    error: (res, status, error) => {
        console.log("Error : ", res);
    },
});

POST data

change the data and endpoint accordingly.

$.ajax({
    url: "https://antares-gp.herokuapp.com/post-data.php",
    method: "POST",
    crossDomain: true,
    data: { 
        data: `{\r\n    \"m2m:cin\": {\r\n    \"con\": \"{\\\"lamp\\\":1}\"\r\n    }\r\n}`,
        endpoint: "https://platform.antares.id:8443/~/antares-cse/antares-id/tesMQTT/esp32",
        accesskey: "Your Access Key" 
    },
    success: (res) => {
        console.log("Success : ", res);
    },
    error: (res, status, error) => {
        console.log("Error : ", res);
    },
});

License

Last Updated : June 13th, 2021

Personal Use Only

About

Alternative library to access Antares HTTP API without causing CORS issue

Topics

Resources

Stars

Watchers

Forks