"Hello, World!"

Basic Deal scenario shows the simplest case of a transaction among nodes.

The participant called Sender initiates deal at the first node. The second participant called Receiver detects deal initiating at the other node.

Transaction parties

  • Sender
  • Receiver

The script consists of the following sequential steps:

  1. At Sender node (Sender - QRM1,HLF1, ETH1) create a Deal
  2. At Sender node change the Deal status to Created
  3. Get the Deal global identifier (Sender - QRM1,HLF1, ETH1)
  4. Make sure at Receiver node the Deal exists and status is Created (Receiver - QRM2,HLF2, ETH2)

Pre-adjustment

Attention!

In the call case the ID is replaced with (LOCALDEALID) word - you need to replace it with your obtained ID when creating the Deal at Step 1.

Attention!

In queries in the headers CHANNEL, AUTHORIZATION you must use the personal identifier you received during registration. This will allow not to interfere with the simultaneous work of several users, as well as facilitate the work of the Technical Support service if you have any questions. The query examples use the personal identifier Demo.

For more information about authorization, visit API: Authorization Page

If you run into any error, visit API: Errors Page

1. Create a Deal

Variables needed:

  • CHANNEL
  • AUTHORIZATION

Use POST-method call /api/deals/. Sender node - QRM1,HLF1, ETH1. The json specification of the transaction is indicated as the request data. In our case:

Body data

{
  "kind": "FirstDeal",
  "parties": [
    {
      "key": "QRM1",
      "role": "Sender"
    },
    {
      "key": "QRM2",
      "role": "Receiver"
    }
  ]
}

Call example


curl -X POST "https://qrm1.kekker.com/api/deals"
-H "Accept: application/json"
-H "x-api-version: 2.0"
-H "Channel: 
" -H "Content-Type: application/json" -H "Authorization:
" -d " { \"kind\": \"FirstDeal\", \"parties\": [ { \"key\": \"QRM1\", \"role\": \"Sender\" }, { \"key\": \"QRM2\", \"role\": \"Receiver\" } ] }"

curl -X POST "https://hlf1.kekker.com/api/deals"
-H "Accept: application/json"
-H "x-api-version: 2.0"
-H "Channel: 
" -H "Content-Type: application/json" -H "Authorization:
" -d " { \"kind\": \"FirstDeal\", \"parties\": [ { \"key\": \"HLF1\", \"role\": \"Sender\" }, { \"key\": \"HLF2\", \"role\": \"Receiver\" } ] }"

curl -X POST "https://eth1.kekker.com/api/deals"
-H "Accept: application/json"
-H "x-api-version: 2.0"
-H "Channel: 
" -H "Content-Type: application/json" -H "Authorization:
" -d " { \"kind\": \"FirstDeal\", \"parties\": [ { \"key\": \"ETH1\", \"role\": \"Sender\" }, { \"key\": \"ETH2\", \"role\": \"Receiver\" } ] }"

Response example

If everything is fine you'll receive the Queue identifier [QUEUID] and the Local Deal Identifier [LOCALDEALID] in the response body. Save them and add to further requests.

{
  "queueId": "QUEUEID",
  "localDealId": "LOCALDEALID"
}

2. At Sender node change the Deal status to Created

Variables needed:

  • CHANNEL
  • AUTHORIZATION
  • LOCALDEALID (from 1-st step)

Use POST-method call /api/deals/{LOCALDEALID} where {LOCALDEALID} is the Local Deal Identifier. Sender node - QRM1,HLF1, ETH1.

Body data

{
  "status": "Created"
}

Call example


curl -X POST "https://qrm1.kekker.com/api/deals/
" -H "Accept: application/json" -H "x-api-version: 2.0" -H "Channel:
" -H "Content-Type: application/json" -H "Authorization:
" -d " { \"status\": \"Created\" }"

curl -X POST "https://hlf1.kekker.com/api/deals/
" -H "Accept: application/json" -H "x-api-version: 2.0" -H "Channel:
" -H "Content-Type: application/json" -H "Authorization:
" -d " { \"status\": \"Created\" }"

curl -X POST "https://eth1.kekker.com/api/deals/
" -H "Accept: application/json" -H "x-api-version: 2.0" -H "Channel:
" -H "Content-Type: application/json" -H "Authorization:
" -d " { \"status\": \"Created\" }"

Response example

If everything is fine you'll receive the Queue identifier [QUEUID] in the response body.

{QUEUEID}

3. Get the Global Deal Identifier

Variables needed:

  • CHANNEL
  • AUTHORIZATION
  • QUEUEID (from the 2-nd step)

Use GET-method call /api/queue/{QUEUEID}. Sender node - QRM1,HLF1, ETH1.

Call example


curl -X GET "https://qrm1.kekker.com/api/queue/
" -H "Accept: application/json" -H "x-api-version: 2.0" -H "Channel:
" -H "Authorization:
"

curl -X GET "https://hlf1.kekker.com/api/queue/
" -H "Accept: application/json" -H "x-api-version: 2.0" -H "Channel:
" -H "Authorization:
"

curl -X GET "https://eth1.kekker.com/api/queue/
" -H "Accept: application/json" -H "x-api-version: 2.0" -H "Channel:
" -H "Authorization:
"

Response example

If everything is fine you'll receive the Global Deal Identifier [DEALID] in the response body. Save it for later.

{
  "dealId": "DEALID",
  "localDealId": "LOCALDEALID",
  "queueId": "QUEUEID",
  "status": "Success"
}

4. Make sure at Receiver node the Deal status is Created

Variables needed:

  • CHANNEL
  • AUTHORIZATION
  • DEALID (from the 3-rd step)

Use GET-method call /api/deals/{DEALID} where {DEALID} is the Global Deal Identifier. Receiver node - QRM2,HLF2, ETH2.

Attention!

Wait for 2 minutes after step [2] before executing these queries

Call example (the node URL is different)


curl -X GET "https://qrm2.kekker.com/api/deals/
" -H "Accept: application/json" -H "x-api-version: 2.0" -H "Channel:
" -H "Authorization:
"

curl -X GET "https://hlf2.kekker.com/api/deals/
" -H "Accept: application/json" -H "x-api-version: 2.0" -H "Channel:
" -H "Authorization:
"

curl -X GET "https://eth2.kekker.com/api/deals/
" -H "Accept: application/json" -H "x-api-version: 2.0" -H "Channel:
" -H "Authorization:
"

Response example (check status)

{
  "dealId": "DEALID",
  "localDealId": "LOCALDEALID",
  "kind": "FirstDeal",
  "version": 2,
  "status": "Created",
  "parent": null,
  "parameters": [],
  "parties": [
    {
      "key": "QRM1",
      "role": "Sender"
    },
    {
      "key": "QRM2",
      "role": "Receiver"
    }
  ],
  "transitions": [],
  "files": [],
  "history": [
    {
      "status": "Created",
      "version": 2,
      "remark": "",
      "executor": "QRM1"
    }
  ]
}

Check the Deal status equals Created

Attention!

If incorrect repeat the second request after a while

Test the platform’s powerful features now

By submitting this form, you confirm that you have read and agree to our privacy policy and terms of service