Skip to main content
info
This documentation is for version v2.6 of the product.
For the latest version(v2.7) documentation click here
Version: v2.6 print this page

REST API

Amorphic Platform provides REST API for developers to access resources. All data is sent and received in JSON format.

rest API example

Basic Authentication​

All the requests are authenticated by personal access token (PAT). For security reasons PAT can only be generated through UI with an expiry period.

Access​

Access to the requests is controlled by amorphic role. role_id uniquely identifies a role.

Endpoint​

This is the base URI value that you see on the API docs page of your amorphic platform.

Usage​

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

cURL
    curl --location --request {{ HTTP_Method }}  '{{ amorphic_gateway_uri }}'  \
--header 'Authorization: {{ PAT }}' \
--header 'role_id: {{ role_id }}'
Javascript
    var settings = {
"url": {{ amorphic_gateway_uri }},
"method": {{ HTTP_METHOD }},
"headers": {
"Authorization": {{ PAT }},
"role_id": {{ role_id }},
"Content-Type": "application/json"
},
};
// jQuery
$.ajax(settings).done(function (response) {
console.log(response);
});
NodeJs
    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
    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
    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 }}