CNHI Credentials

Form of a CNHI Credentials resource:

{
"clientId": "str",
"clientSecret": "str",
"subscriptionKey": "str",
"refreshToken": "str",
"clientEnvironment": "STAGE or PRODUCTION"
}

All HTTP methods should be prepended by this service's endpoint:

https://api.withleaf.io/services/usermanagement/api

See below the REST resources and their endpoints available in this service.

Endpoints

DescriptionEndpoints
Get the CNHI credentialsGET /users/{leafUserId}/cnhi-credentials
Create a CNHI credentialsPOST /users/{leafUserId}/cnhi-credentials
Delete CNHI credentialsDELETE /users/{leafUserId}/cnhi-credentials

CNHI Credentials Endpoints

Get the CNHI credentials

 GET /users/{leafUserId}/cnhi-credentials

Get the CNHI credentials of the Leaf User based on its id and returns a JSON with the credentials. If during background processing we detect that this credential is no longer valid, the value of the status will be changed.

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}/cnhi-credentials'

Response

{
"id": "str",
"status": "str",
"createdTime": "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'",
"clientId": "str",
"clientSecret": "str",
"refreshToken": "str",
"clientEnvironment": "STAGE or PRODUCTION",
"subscriptionKey": "str"
}

Create a CNHI credentials

 POST /users/{leafUserId}/cnhi-credentials

Create a CNHI credentials for the Leaf User.

Request body

{
"clientId": "str",
"clientSecret": "str",
"subscriptionKey": "str",
"refreshToken": "str",
"clientEnvironment": "STAGE or PRODUCTION"
}

Request examples

curl -X POST \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"clientId": "str", "clientSecret": "str", "subscriptionKey": "str", "refreshToken": "str", "clientEnvironment": "STAGE or PRODUCTION"}' \
'https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}/cnhi-credentials'

Response

A CNHI credentials with status.

{
"id": "str",
"status": "str",
"createdTime": "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'",
"clientId": "str",
"clientSecret": "str",
"refreshToken": "str",
"clientEnvironment": "STAGE or PRODUCTION",
"subscriptionKey": "str"
}

Delete CNHI credentials

 DELETE /users/{leafUserId}/cnhi-credentials

Delete Leaf User's CNHI credentials.

Request examples

curl -X DELETE \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}/cnhi-credentials'

Troubleshooting

With these endpoints, you can do some troubleshooting to see your credential's health.

Events

 GET /users/{leafUserId}/cnhi-credentials/events

Get the logs of the provider credential based on the LeafUserId sent.

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}
/cnhi-credentials/events'

Response

[
{
"body": "string",
"createdDate": "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'",
"headers": "string",
"id": "string",
"statusCode": "int"
}
]
warning

The logs are available only for 30 days and once the credential is deleted or disassociated with the Leaf User, the logs are no longer available.