Execute

Execute

This method executes rules and challenge queries indicated by a given scenario.

Parameters

  • address (object, required): The address object required for the execution.
  • credentials (array of objects, required): The credentials array, containing credential details.
    • id (string, required)
    • @context (array of strings, required)
    • type (array of strings, required)
    • expirationDate (string, required)
    • issuanceDate (string, required)
    • credentialSubject (object, required)
    • credentialStatus (object, required)
      • id (string, required)
      • type (string, required)
      • revocationNonce (integer, required)
    • issuer (string, required)
    • credentialSchema (object, required)
      • id (string, required)
      • type (string, required)
    • proof (object, required)
  • scenarioId (string, required): The unique identifier of the scenario.

Returns

  • A JSON array containing the execution results with the following fields:
    • objectType (string, required): Possible values: ChallengeQuery, OnChainZKP, OffChainZKP
    • objectId (string, required): Object id in the cms (challengeQueryid, onChainZKPid, offChainZKPid)
    • name (string, required)
    • address (string, required)
    • result (object, required)
    • executionId (string, required)
    • scenarioId (string, required)

Usage Example

const axios = require('axios');
let data = JSON.stringify({
  "address": "string",
  "credentials": [
    {
      "id": "string",
      "@context": [
        "string"
      ],
      "type": [
        "string"
      ],
      "expirationDate": "string",
      "issuanceDate": "string",
      "credentialSubject": {},
      "credentialStatus": {
        "id": "string",
        "type": "SparseMerkleTreeProof",
        "revocationNonce": 0
      },
      "issuer": "string",
      "credentialSchema": {
        "id": "string",
        "type": "string"
      },
      "proof": {}
    }
  ],
  "scenarioId": "string"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.nexera.id/compliance/scenarios/execute',
  headers: { 
    'Content-Type': 'application/json', 
    'Accept': 'application/json', 
    'Authorization': 'Bearer <TOKEN>'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});