On-Prem App - API Integration

The On-Prem partner application activation involves the following steps:

Procedure


Step 1

The Customer must copy the Activation Token (JWT) that was generated earlier during the application activation process (in the Cisco DNA Spaces dashboard) and paste it in the Partner’s On-Prem application, where the Cisco DNA Spaces connection setup must be configured.

Here’s a sample Activation Token:

eyJ0eXAiOiJKV1QiLC<XXXXXXXXXXXXXXXXXXXX>SIsImFjdGl2YXRpb25SZWZJZCI6IjBEO
DVBMTQ0QTM0RTRDQ0NBQzFERjkwQzFFNzc0OTQzIiwiY3VzdG9tZXIiOiJUcmlndWUiLCJleHBpcmVzSW4
iOjE1NjE3MDMxMzQyNzEsInRlbmFudElkIjo0MjAsImJhc2VVcmwiOiJodHRwczovL3BhcnRuZXJzLmRld
i1kbmFzcGFjZXMuaW8iLCJwYXJ0bmVyVGVuYW50SWQiOiIwRDg1QTE0NEEzNEU0Q0NDQUMxREY5MEMxRTc3
NDk0MyIsImlhdCI6MTU2MTY5OTUzNCwiZXhwIjoxNTYxNzAzMTM0fQ.n6TenjTHdBw5VHLHO_rk6OpgR8Q0
waU1ynovI_qWOgzcuNw2tqatXTNq6vTOo5vRzAtGRu4zYz34Y33NYA-zoQaTx3krb4fKr8DSmRcQ4xCFrI0
3ZkaZTtfi7uGrd-7TkOfFqPQgsZMLW7_IoYMFhpEunOu3gvijxQ00UYIQhgo
The decoded Activation Token would be similar to the below sample:
{

"appId": "app-31688AFCCAD44F4E9EE7C0CF7DFC993E",

"version": "v1",

"activationRefId": "568850F2CF5A466F8BBA5C895863EE60",

"customer": "Trigue",

"expiresIn": 1559201374033,

"tenantId": 420,

"baseUrl": "https://partners.dnaspaces.io",

"partnerTenantId": "0D85A144A34E4CCCAC1DF90C1E774943",

"iat": 1559201074,

"exp": 1559201374

}

Step 2

The Partner’s On-Prem application must validate the Activation Token by following the below steps:

  1. To validate the activation token, make sure to get the public key from Cisco DNA Spaces using the partnerPublicKey API.

  2. Validate the Activation Token by using the public key retrieved using the above step.

Step 3

If the token is valid, the Partner On-Prem application should invoke the Cisco DNA Spaces App activation API (which returns the API key) to activate the App for the Customer.


App Activation API Endpoint: <base-url>/client/v1/partner/activateOnPremiseApp 
Method: POST 
Content-Type: application/json
Authorization: Bearer <The generated Activation Token>
JSON Payload   
{    
"appId": "<appId extracted from activation token>",
"activationRefId": "<activationRefId extracted from activation token>"
"instanceName": "<Optional parameter, which indicates the location name>" 
}

Response JSON from App Activation API:

Data Parameter

Description

Allowed values

appId

Refers to the unique Identifier for the application.

String

activationRefId

Activation Reference Identifier

String

  • All valid: If the “appId” and “activationRefId” is valid, then the reponse would be similar to the example below:

    
    {
        "status": true,
        "message": "Successfully activated the on-premise application.",
        "data": {
            "apiKey": "***********************"
        }
    }
    
  • Failed validation: If the “appId” or “activationRefId” validation fails, then the response will be as shown below:

    
    {
        "status": false,
        "message": "Activation Token Invalid",
    }
    
  • Reactivation with same token: If the same token is used again after the app has been successfully activated, then the app is deactivated and the reponse would be similar to the below example:

    
    {
        "status": false,
        "message": "The on premise application (app-***********************) is deactivated due to reactivation is processed.",
        <Suggestion>: "Deactivated the on-premise application (app-***********************). A token can only be used once for app activation.",
        "data": null
    }
    
  • Expired token: If a token is used after it expires, then the response will be as shown below:
    
    {
        "status": false,
        "message": "Activation Token Expired.",
    }
    

Step 4

Use the apiKey from the response to invoke the partner APIs to receive the events data.