Getting started
The core of the Noumena Platform is the Operating Engine.
See the components that are required to run it.
The Engine is the application that is used to create and interact with instances of protocols. In order to get started with using the engine, you will need to do the following.
- Deploy the Engine Application
- Upload NPL sources with the Engine Management API or at engine start up, described here, or with the Engine Maven Plugin.
- Get an OAuth token from your IAM application.
- Create an instance of a Protocol with the
createProtocol
endpoint in the Engine API.
Example Requests
Below is an example curl
request to create an instance of the
Iou
protocol.
curl -X POST \
'http://localhost:12000/api/engine/protocols' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer ${TOKEN}' \
-H 'Content-Type: application/json' \
-d '{
"prototypeId": "/iou.npl/Iou",
"parties": [
{
"entity": {
"claims": {
"iss": ["http://www.noumenadigital.com"],
"org": ["Bank of Noumena"]
}
},
"access": {}
},
{
"entity": {
"claims": {
"iss": ["http://www.google.com"],
"org": ["Startup Inc"]
}
},
"access": {}
}
],
"arguments": [
{
"nplType": "number",
"value": 100
}
]
}'
Now you can start calling an action on
that instance with the exerciseAction
endpoint. Below is an example curl
request, using a protocolId
result from
the previous request, to call the pay
action on that instance.
curl -X POST \
'http://localhost:12000/api/engine/protocols/acdaff2b-7c75-48a7-8649-b9eb437fbf63/actions/pay?caller=%7B%0A%20%20%22value%22%3A%20%22John%22%0A%7D' \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${TOKEN}" \
-H 'Content-Type: application/json' \
-d '[
{
"nplType": "number",
"value": 50
}
]'
These are examples with curl
to give an idea of the request and the contents needed to interact with the platform, but
you will most likely want to make your API requests from your application that you create alongside the platform, as
shown in this example topology.
The platform provides various HTTP clients that you can utilise in order to interact with the API, such as the
ApplicationHttpClient
, AdminHttpClient
and ManagementHttpClient
.