Transform Preview Error - Postman

When I tried to validate the transform through Postman API I got the following error message. Any help would be appreciated

POST:{{baseUrl}}/cc/api/user/preview/:1d

Postman Body

{
    "attributeTransforms": [
        {
            "attributeName": "displayName",
            "type": "accountAttribute",
            "attributes": {
                "attributeName": "givenName",
                "sourceName": "Admin Accounts"
            }
        }
    ]
}

Error Message

There was an error in evaluating the Pre-request Script:Error: Unexpected token u in JSON at position 0

Hi @sivakumarnallu,

I not sure about the endpoint you shared, if you can share details like where you got it from. I should help debug better. I think it’s not in the official collection, maybe a private endpoint.

POST:{{baseUrl}}/cc/api/user/preview/:1d

Per my understanding of your requirement if you are looking for a way to generate preview for the applied transforms you can try the Generate Identity Preview API endpoint from SailPoint Beta APIs.

Endpoint looks like this,

POST /beta/identity-profiles/identity-preview

and based on your requirement the response body should look something like the following,

{
  "identityId": "<identity_id>",
  "identityAttributeConfig": {
    "enabled": true,
    "attributeTransforms": [
      {
        "identityAttributeName": "displayName",
        "transformDefinition": {
          "type": "accountAttribute",
          "attributes": {
            "attributeName": "givenName",
            "sourceName": "givenName",
            "sourceId": "<source_id>"
          }
        }
      }
    ]
  }
}

This should give a response something like this,

{
  "identity": {
    "type": "IDENTITY",
    "id": "2c91808568c529c60168cca6f90c1313",
    "name": "William Wilson"
  },
  "previewAttributes": [
    {
      "name": "email",
      "value": "[email protected]",
      "previousValue": "[email protected]",
      "errorMessages": [
        {
          "locale": "en-US",
          "localeOrigin": "DEFAULT",
          "text": "The request was syntactically correct but its content is semantically invalid."
        }
      ]
    }
  ]
}

Hope this helps.

Your Postman collection has Pre-request Script which needs domain and tenant environment variables to generate the token. Make sure you have them, this error is related to that only.

This is an error from the script which generates the token. Try to use the token from https://tenant.identitynow.com/ui/session From there you will get the Access token place that in your Postman and see if it works.

Thanks

Hi @sivakumarnallu , are other IDN API requests working fine from your Postman collection?
Also, please check all environment variables defined in your Postman collection.

Hi Krishna,
Thanks for your reply. Can you share some URL or guide for the pre request script. I just forked the collection (private)and generated the session token as always that didn’t work. All other postman collections are working when I generated the session token (v3, and beta). However, this one (You tube URL) shared as private and didn’t mention anything about the pre request script. Much appreciated, if you could guide.

I tried by generating the session token the same way other postman collection. But this is private collection which is shared below URL didn’t work. I am not sure whether it requires any prerequest script something like that since error message point the prerequest script. If you could guide, much appreciated.

Hey @sivakumarnallu,

As others have shared, this error is related to your environment not being configured so that the token can be pulled via the pre-request script.

Check out this link for help with configuration! Postman Collections | SailPoint Developer Community

The important environment variables that need to be set I have included below in this table:

Environment Variable Required Description
tenant Yes Your IDN tenant, typically your company’s name
clientId Yes The client ID for the API client or personal access token
clientSecret Yes The client secret for the API client or personal access token
1 Like

Look into this post, it might help you to understand from

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.