REST api

Overview

platform provides REST API for developers to access resources. All data is sent and received as JSON.

Usage

Please refer to the API docs page for schema information for API requests. Replace variables enclosed in {} with the corresponding values.

cURL

1
2
3
curl --location --request {{ HTTP_Method }}  '{{ amorphic_gateway_uri }}'  \
     --header 'Authorization: {{ PAT }}'  \
     --header 'role_id: {{ role_id }}'

Javascript

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
var settings = {
 "url": {{ amorphic_gateway_uri }},
 "method": {{ HTTP_METHOD }},
 "headers": {
   "Authorization": {{ PAT }},
   "role_id": {{ role_id }},
   "Content-Type": "application/json"
 },
};

$.ajax(settings).done(function (response) {
 console.log(response);
});

NodeJs

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
var request = require('request');
var options = {
  'method': {{ HTTP_METHOD }},
  'url': {{ amorphic_gateway_uri }},
  'headers': {
    'Authorization': {{ PAT }},
    'role_id': {{ role_id }},
    'Content-Type': 'application/json'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import http.client
import mimetypes
conn = http.client.HTTPSConnection({{ amorphic_gateway_uri }})
payload = ''
headers = {
  'Authorization': {{ PAT }},
  'role_id': {{ role_id }},
  'Content-Type': 'application/json'
}
conn.request({{ HTTP_METHOD }}, "", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Shell

1
2
3
4
5
6
7
wget --no-check-certificate --quiet \
     --method {{ HTTP_METHOD }} \
     --timeout=0 \
     --header 'Authorization: {{ PAT }}' \
     --header 'role_id: {{ role_id }}' \
     --header 'Content-Type: application/json' \
     {{ amorphic_gateway_uri }}