Create Entitlement API

What is the API to create an entitlement in a Source?

There currently is no API to create entitlements. If you are working with a delimited file source, then you can create entitlements by uploading a CSV with all of your entitlements. This is done in the “Import Entitlements” page in the “Import Data” tab of the delimited file source.

@colin_mckibben thank you for your response.

I tried to capture the request using the chrome developer tool while importing the entitlement, but can see only the below. Is there any possible way to get the request from developer tool?

https://partnerinstance.api.identitynow.com/cc/api/source/loadEntitlements/12345

What you see here is a v1 API that uploads a CSV file of entitlements. V1 APIs aren’t gauranteed to be stable or supported, so please be cautious when using them.

I looked it up in my Chrome dev tools, and here is how you can use it.

POST https://partnerinstance.api.identitynow.com/cc/api/source/loadEntitlements/{sourceId}

The payload is a content type of multipart/form-data, which is the contents of your entitlements CSV file. The following cURL call should work:

curl --location --request POST 'https://{org}.api.identitynow.com/cc/api/source/loadEntitlements/{sourceId}' \
--header 'Authorization: Bearer {access_token}' \
--form 'data=@"/path/to/entitlements.csv"'

@colin_mckibben Thank you for your response. I have already tried the above and was getting the below error for my test delimited application.

{
    "msg_template": "IllegalArgumentException: s3Bucket and s3Key are required for source \"TestDelimitedApplication [source]\" of type Delimited File",
    "slpt_error_code": "SLPT-1009",
    "formatted_msg": "IllegalArgumentException: s3Bucket and s3Key are required for source \"TestDelimitedApplication [source]\" of type Delimited File",
    "exception_id": "17D71A615AB",
    "error_code": 1009,
    "exception_class": "groovyx.net.http.HttpResponseException",
    "exception_detail": {
        "file": "RESTClient.java",
        "method": "defaultFailureHandler",
        "line_number": 240,
        "class": "groovyx.net.http.RESTClient"
    },
    "http_response_code": 400,
    "timestamp": "2021-11-30 16:20:49.707",
    "exception_message": "Bad Request"
}

Upon closer inspection it seems that my cURL command is failing for me as well. The key data is incorrect. It should be file. Here is the correct cURL command.

curl --location --request POST 'https://{org}.api.identitynow.com/cc/api/source/loadEntitlements/{sourceId}' \
--header 'Authorization: Bearer {access_token}' \
--form 'file=@"/path/to/entitlements.csv"'