Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Unable to send dynamic value to Coupa Application via Rest Connection

Shwet01
Regular Contributor
Regular Contributor

Hi Everyone,

We are integrating Saviynt with Coupa application for provisioning. When we are using static value inside JSON for create account json or access token then connection is working as expected and accounts are getting created inside coupa application.
But when we are trying to pass dynamic access token in connection JSON or passing dynamic attribute inside Create Account Json. Neither connection is establishing nor account is getting created.
We checked the other working rest API connections as well, the format is same but still have the issue.
 
 
Meta data reponse from coupa-{"customproperty5":"abctestingab_inbev.com~#~char","customproperty2":"${user.firstname}~#~char","customproperty1":"abctesting@xxx.COM~#~char","displayName":"${user.firstname} ${user.lastname}~#~char","name":"abctesting@xxxx.COM~#~char","_id":320309,"customproperty14":"320296~#~char"}
 
 
Create Account Json with static attribute and static Access token-
{
    "accountIdPath": "call1.message.id",
    "responseColsToPropsMap": {
        "displayName": "call1.message.fullname~#~char",
        "name": "call1.message.login~#~char",
        "customproperty1": "call1.message.email~#~char",
        "customproperty2": "call1.message.firstname~#~char",
        "customproperty3": "call1.message.lastName~#~char",
        "customproperty5": "call1.message.mention-name~#~char",
        "customproperty14": "call1.message.created-by.id~#~char"
    },
    "call": [
        {
            "name": "call1",
            "connection": "acctAuth",
            "url": "https://xxxxxxxx.coupahost.com/api/users/",
            "httpMethod": "POST",
            "httpParams": "{\"login\":\"avctesting@AB-INBEV.COM\",\"active\":true,\"email\":\"avctesting@AB-INBEV.COM\",\"firstname\":\"${user.firstname}\",\"lastname\":\"${user.lastname}\",\"fullname\":\"${user.displayName}\"}",
            "httpHeaders": {
                "accessToken": "eyJ0eXAiOiJhdCtKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjRmOjMzOmI3OmY3OjVmOjg4OjQ3OmRhOjAzOmVmOjkzOjQ1OmU5OmNjOmZiOjg3In0.eyJpc3MiOiJodHRwczovL2FiLWluYmV2LXRlc3QuY291cGFob3N0LmNvbSIsImlhdCI6MTY4OTA2OTg5OSwiZXhwIjoxNjg5MTU2Mjk5LCJzdWIiOiIxMDIzZmRhODExYzc3OTRlNGNkOWQ0MTk5YWM5ZGJjYiIsImp0aSI6IjBkODlkZWUzLWZjMTAtNGM1OC04ZDJhLTRkNjFhMjg4ZjY1NyIsImNsaWVudF9pZCI6IjEwMjNmZGE4MTFjNzc5NGU0Y2Q5ZDQxOTlhYzlkYmNiIiwic2NvcGUiOiJjb3JlLnVzZXJfZ3JvdXAucmVhZCBjb3JlLnVzZXJfZ3JvdXAud3JpdGUgY29yZS51c2VyLnJlYWQgY29yZS51c2VyLndyaXRlIGVtYWlsIGxvZ2luIHByb2ZpbGUiLCJhdWQiOlsiY29yZSJdfQ.KTmB8xxJFFCZ4j9y2R-Z4Tss5D6_RgxJw3kssWHLy5fGQlBZ5dKfwO0B-EyduRW_dAJf9kTOWud_KL9zMehYeB7kc1Ef1uGgVsTZhmcShpvdxk71B7m_Q6Goksa15j_Rtc4YOzOsD7yHIB_LYrQE_StKDZjWBqky31u7B9YVlClkn2M4BEzeXEw7NCp3-LKgaHigB37SvIKnvNni3OtGg-8ULXqz-yB-ZGCDONykaBZ37eGvCcK3AIGx5ZW_GCyc3g-1rYr782bZULpKRue9EGc-r0ufCHbvHbApnJDHp9X24lgSkTwy56RWmE7gRMdWZW8NtuLzwC0EyTSW3XlpNg",
                "Accept": "application/json"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    200
                ]
            }
        }
    ]
}
 

Thnks

shwet

6 REPLIES 6

pmahalle
All-Star
All-Star

Can you provide the the connection and created account json with which you are facing issue.


Pandharinath Mahalle(Paddy)
If this reply helps your question, please consider selecting Accept As Solution and hit Kudos 🙂

Shwet01
Regular Contributor
Regular Contributor

Hi @pmahalle ,

Thank you for the response.

Connection JSON-

 

{
  "authentications": {
    "acctAuth": {
      "authType": "oauth2",
      "url": "https://xxxxxxxx.coupahost.com/oauth2/token",
      "httpMethod": "POST",
      "httpParams": {
      "client_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
      "client_id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
      "scope": "core.user_group.read core.user_group.write core.user.read core.user.write email login profile"
},
      "httpHeaders": {
        "contentType": "application/x-www-form-urlencoded"
      },
      "httpContentType": "application/x-www-form-urlencoded",
      "expiryError": "ExpiredAuthenticationToken",
      "authError": [
        "InvalidAuthenticationToken",
        "AuthenticationFailed"
      ],
      "timeOutError": "Read timed out",
      "errorPath": "error.code",
      "maxRefreshTryCount": 5,
      "tokenType": "bearer",
      "tokenResponsePath": "access_token",
      "authHeaderName": "Authorization",
      "accessToken": "Bearer eyJ0eXAiOiJhdCtKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjRmOjMzOmI3OmY3OjVmOjg4OjQ3OmRhOjAzOmVmOjkzOjQ1OmU5OmNjOmZiOjg3In0.eyJpc3MiOiJodHRwczovL2FiLWluYmV2LXRlc3QuY291cGFob3N0LmNvbSIsImlhdCI6MTY4OTA2OTg5OSwiZXhwIjoxNjg5MTU2Mjk5LCJzdWIiOiIxMDIzZmRhODExYzc3OTRlNGNkOWQ0MTk5YWM5ZGJjYiIsImp0aSI6IjBkODlkZWUzLWZjMTAtNGM1OC04ZDJhLTRkNjFhMjg4ZjY1NyIsImNsaWVudF9pZCI6IjEwMjNmZGE4MTFjNzc5NGU0Y2Q5ZDQxOTlhYzlkYmNiIiwic2NvcGUiOiJjb3JlLnVzZXJfZ3JvdXAucmVhZCBjb3JlLnVzZXJfZ3JvdXAud3JpdGUgY29yZS51c2VyLnJlYWQgY29yZS51c2VyLndyaXRlIGVtYWlsIGxvZ2luIHByb2ZpbGUiLCJhdWQiOlsiY29yZSJdfQ.KTmB8xxJFFCZ4j9y2R-Z4Tss5D6_RgxJw3kssWHLy5fGQlBZ5dKfwO0B-EyduRW_dAJf9kTOWud_KL9zMehYeB7kc1Ef1uGgVsTZhmcShpvdxk71B7m_Q6Goksa15j_Rtc4YOzOsD7yHIB_LYrQE_StKDZjWBqky31u7B9YVlClkn2M4BEzeXEw7NCp3-LKgaHigB37SvIKnvNni3OtGg-8ULXqz-yB-ZGCDONykaBZ37eGvCcK3AIGx5ZW_GCyc3g-1rYr782bZULpKRue9EGc-r0ufCHbvHbApnJDHp9X24lgSkTwy56RWmE7gRMdWZW8NtuLzwC0EyTSW3XlpNg",
      "retryFailureStatusCode": [
        401
      ]
    }
  }
}

Create Account JSON-

{
    "accountIdPath": "call1.message.id",
    "responseColsToPropsMap": {
        "customproperty2": "call1.message.firstname~#~char",
        "customproperty3": "call1.message.lastName~#~char",
        "customproperty5": "call1.message.mention-name~#~char",
        "customproperty14": "call1.message.created-by.id~#~char",
"customproperty15": "call1.message.authentication-method~#~char",
"customproperty16": "call1.message.sso-identifier~#~char",
"customproperty17": "call1.message.default-currency:code~#~char"
       },
    "call": [
        {
            "name": "call1",
            "connection": "acctAuth",
            "url": "https://xxxxxxxx.coupahost.com/api/users/",
            "httpMethod": "POST",
            "httpParams": ""{\"login\":\"avctesting@xxx.COM\",\"active\":true,\"email\":\"avctesting@xxx.COM\",\"firstname\":\"${user.firstname}\",\"lastname\":\"${user.lastname}\",\"fullname\":\"${user.displayName}\"}",
            "httpHeaders": {
"accessToken": "eyJ0eXAiOiJhdCtKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjRmOjMzOmI3OmY3OjVmOjg4OjQ3OmRhOjAzOmVmOjkzOjQ1OmU5OmNjOmZiOjg3In0.eyJpc3MiOiJodHRwczovL2FiLWluYmV2LXRlc3QuY291cGFob3N0LmNvbSIsImlhdCI6MTY4OTA2OTg5OSwiZXhwIjoxNjg5MTU2Mjk5LCJzdWIiOiIxMDIzZmRhODExYzc3OTRlNGNkOWQ0MTk5YWM5ZGJjYiIsImp0aSI6IjBkODlkZWUzLWZjMTAtNGM1OC04ZDJhLTRkNjFhMjg4ZjY1NyIsImNsaWVudF9pZCI6IjEwMjNmZGE4MTFjNzc5NGU0Y2Q5ZDQxOTlhYzlkYmNiIiwic2NvcGUiOiJjb3JlLnVzZXJfZ3JvdXAucmVhZCBjb3JlLnVzZXJfZ3JvdXAud3JpdGUgY29yZS51c2VyLnJlYWQgY29yZS51c2VyLndyaXRlIGVtYWlsIGxvZ2luIHByb2ZpbGUiLCJhdWQiOlsiY29yZSJdfQ.KTmB8xxJFFCZ4j9y2R-Z4Tss5D6_RgxJw3kssWHLy5fGQlBZ5dKfwO0B-EyduRW_dAJf9kTOWud_KL9zMehYeB7kc1Ef1uGgVsTZhmcShpvdxk71B7m_Q6Goksa15j_Rtc4YOzOsD7yHIB_LYrQE_StKDZjWBqky31u7B9YVlClkn2M4BEzeXEw7NCp3-LKgaHigB37SvIKnvNni3OtGg-8ULXqz-yB-ZGCDONykaBZ37eGvCcK3AIGx5ZW_GCyc3g-1rYr782bZULpKRue9EGc-r0ufCHbvHbApnJDHp9X24lgSkTwy56RWmE7gRMdWZW8NtuLzwC0EyTSW3XlpNg",
                "Accept": "application/json"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    200,
201
                ]
            }
        }
    ]
}
 
In this connection you can see when i am passing access token as ${access_token}, it is not establishing connection but when i passed the static token it worked.
In same way, when we passed the json in create account json as ${user.email} etc it did not worked so i hardcoded the email and tried, then it created account in coupa and coupa created firstname as ${user.firstname} and lastname as ${user.lastname}. 

Thanks

shwet

Hi

Can you try with below CreateAccount Json with hardcoded token:

Create Account JSON-

{
    "accountIdPath": "call1.message.id",
    "responseColsToPropsMap": {
        "customproperty2": "call1.message.firstname~#~char",
        "customproperty3": "call1.message.lastName~#~char",
        "customproperty5": "call1.message.mention-name~#~char",
        "customproperty14": "call1.message.created-by.id~#~char",
"customproperty15": "call1.message.authentication-method~#~char",
"customproperty16": "call1.message.sso-identifier~#~char",
"customproperty17": "call1.message.default-currency:code~#~char"
       },
    "call": [
        {
            "name": "call1",
            "connection": "acctAuth",
            "url": "https://xxxxxxxx.coupahost.com/api/users/",
            "httpMethod": "POST",
            "httpParams": "{\"login\":\"${user.email}\",\"active\":true,\"email\":\"${user.email}\",\"firstname\":\"${user.firstname}\",\"lastname\":\"${user.lastname}\",\"fullname\":\"${user.displayname}\"}",
            "httpHeaders": {
"accessToken": "eyJ0eXAiOiJhdCtKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjRmOjMzOmI3OmY3OjVmOjg4OjQ3OmRhOjAzOmVmOjkzOjQ1OmU5OmNjOmZiOjg3In0.eyJpc3MiOiJodHRwczovL2FiLWluYmV2LXRlc3QuY291cGFob3N0LmNvbSIsImlhdCI6MTY4OTA2OTg5OSwiZXhwIjoxNjg5MTU2Mjk5LCJzdWIiOiIxMDIzZmRhODExYzc3OTRlNGNkOWQ0MTk5YWM5ZGJjYiIsImp0aSI6IjBkODlkZWUzLWZjMTAtNGM1OC04ZDJhLTRkNjFhMjg4ZjY1NyIsImNsaWVudF9pZCI6IjEwMjNmZGE4MTFjNzc5NGU0Y2Q5ZDQxOTlhYzlkYmNiIiwic2NvcGUiOiJjb3JlLnVzZXJfZ3JvdXAucmVhZCBjb3JlLnVzZXJfZ3JvdXAud3JpdGUgY29yZS51c2VyLnJlYWQgY29yZS51c2VyLndyaXRlIGVtYWlsIGxvZ2luIHByb2ZpbGUiLCJhdWQiOlsiY29yZSJdfQ.KTmB8xxJFFCZ4j9y2R-Z4Tss5D6_RgxJw3kssWHLy5fGQlBZ5dKfwO0B-EyduRW_dAJf9kTOWud_KL9zMehYeB7kc1Ef1uGgVsTZhmcShpvdxk71B7m_Q6Goksa15j_Rtc4YOzOsD7yHIB_LYrQE_StKDZjWBqky31u7B9YVlClkn2M4BEzeXEw7NCp3-LKgaHigB37SvIKnvNni3OtGg-8ULXqz-yB-ZGCDONykaBZ37eGvCcK3AIGx5ZW_GCyc3g-1rYr782bZULpKRue9EGc-r0ufCHbvHbApnJDHp9X24lgSkTwy56RWmE7gRMdWZW8NtuLzwC0EyTSW3XlpNg",
                "Accept": "application/json"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    200,
201
                ]
            }
        }
    ]
}
 
One more thing, are you able to generate token in Postman by using client_id, client_secret and scope, right?

Pandharinath Mahalle(Paddy)
If this reply helps your question, please consider selecting Accept As Solution and hit Kudos 🙂

Shwet01
Regular Contributor
Regular Contributor

Hi @pmahalle ,

This code worked. Actually we were also passing the same json. May i ask exactly where was the error in code. I am still not able to figure out the problem.

 

Thanks

shwet

Thanks

Hi @Shwet01 ,

You were using displayName which is not correct. it should be displayname.

Also, are you able to generate token using connection json?


Pandharinath Mahalle(Paddy)
If this reply helps your question, please consider selecting Accept As Solution and hit Kudos 🙂

Shwet01
Regular Contributor
Regular Contributor

Yes we are able to generate token in connection json @pmahalle . Now everything is working as expected.