Webservice Connector - Update Account - empty requestBody

Dear Experts,

I am trying to trigger the “Update Account” endpoint with the Attribute Sync configuration. At the moment I have only configured 2 attribiutes to be synced:

  1. Firstname
  2. Lastname

I am printing the AttributeRequests on the Plan in the beforeRule where I can see that both these values are present on the plan. However, when I print the requestEndpoint object, I see that the jsonBody is empty. Does anyone know what can cause this?

EndPoint [_afte
rRule=WebServiceAfterOperationRule-UpdateAccount2, _beforeRule=WebServiceBeforeOperationRule-UpdateAccount2, _contextUrl=\/v1\/people\/username=QICCF?type=internal, _fullUrl=https:\/\/xxxx-api.sabacloud.com\/v1\
/people\/username=QICCF?type=internal, _httpMethodType=PUT, _operationType=Update Account, _rootPath=null, _uniqueNameForEndPoint=Update Account 2 (Update Object), paginationSteps=null, pagingInitialOffset=0, pagingSize=50, _resMappingObj={}, _he
ader={SabaCertificate=xxxxx, Content-Type=application\/json}, _body={bodyFormat=raw}, _responseCode=null, _sequenceNumberForEndpoint=10, xpathNamespaces={}, possibleHttpErrors={}]

Notes:
Since the “Update Account” is a PUT operation I have configured another “Update Account” operation before it to Get the whole user object - this is working. I am able to see that the user object is passed is the response of the first “Update Account” call.

Thanks and looking forward to suggestions!
Tamalika

Hey @tamalika01 ,

Could you provide the request body you have configured for both the “Update Account” ?

hi @tamalika01,

Based on the endpoint that you have put in your query it looks like you have not saved your body after you have editied.

_body={bodyFormat=raw}
Can you map the response from the first update response.
you need to use “$response.<attributeName from Update Operation -1>$” to consider that.

I know this multiple Get and Put operation works for Enable and Disable account. I was not successful in doing it for Update. You may have to use beforeoperation rule and single update account operation if the above method does not work.

Thanks.
Uday

Here it is:

Operation 1:

{
                "httpMethodType": "GET",
                "pagingInitialOffset": 0,
                "sequenceNumberForEndpoint": "11",
                "uniqueNameForEndPoint": "Update Account 1 (Get Object)",
                "curlCommand": null,
                "rootPath": null,
                "body": {
                    "bodyFormData": null,
                    "jsonBody": null,
                    "bodyFormat": "raw"
                },
                "customAuthUrl": null,
                "paginationSteps": null,
                "responseCode": null,
                "resMappingObj": {
                    "associations": "associations",
                    "country": "country",
                    "gender": "gender",
                    "homephone": "homephone",
                    "date_of_birth": "date_of_birth",
                    "person_type": "person_type",
                    "ss_no": "ss_no",
                    "mname": "mname",
                    "jobtype_id": "jobtype_id",
                    "title": "title",
                    "location_id": "location_id",
                    "securityRoles": "securityRoles",
                    "job_title_type": "job_title_type",
                    "lname": "lname",
                    "password": "",
                    "manager_id": "manager_id",
                    "started_on": "started_on",
                    "workphone": "workphone",
                    "id": "id",
                    "job_title": "job_title",
                    "email": "email",
                    "customValues": "customValues",
                    "securityDomain": "securityDomain",
                    "fname": "fname",
                    "company_id": "company_id",
                    "terminated_on": "terminated_on",
                    "is_manager": "is_manager",
                    "person_no": "person_no",
                    "special_user": "special_user",
                    "home_company_id": "home_company_id",
                    "timezone_id": "timezone_id",
                    "home_domain": "home_domain",
                    "status": "status",
                    "username": "username"
                },
                "contextUrl": "/v1/people/username=$getobject.nativeIdentity$?type=internal",
                "pagingSize": 50,
                "curlEnabled": false,
                "header": {
                    "SabaCertificate": "$application.SabaCertificate$"
                },
                "operationType": "Update Account",
                "beforeRule": "WebServiceBeforeOperationRule-GetObjectUpdateAccount1",
                "xpathNamespaces": null,
                "parentEndpointName": null
            }

Operation 2:

{
                "httpMethodType": "PUT",
                "pagingInitialOffset": 0,
                "sequenceNumberForEndpoint": "12",
                "uniqueNameForEndPoint": "Update Account 2 (Update Object)",
                "curlCommand": null,
                "rootPath": null,
                "body": {
                    "jsonBody": "{\n    \"username\": \"$response.username$\",\n\t\"fname\": \"$plan.fname$\",\n    \"lname\": \"$plan.lname$\",\n    \"title\": \"$response.title$\",\n    \"password\": \"$response.password$\",\n    \"gender\": \"$response.gender$\",\n    \"country\": \"$response.country$\",\n    \"status\": \"$response.status$\",\n    \"email\": \"$response.email$\",\n    \"person_type\": \"$response.person_type$\",\n    \"started_on\": \"$response.started_on$\",\n    \"terminated_on\": \"$response.terminated_on$\",\n    \"person_no\": \"$response.person_no$\",\n    \"workphone\": \"$response.workphone$\",\n    \"job_title\": \"$response.job_title$\",\n    \"is_manager\": \"$response.is_manager$\",\n    \"special_user\": \"$response.special_user$\",\n    \"associations\": \"$response.associations$\",\n    \"customValues\": \"$response.customValues$\",\n    \"manager_id\": \"$response.manager_id$\",\n    \"securityDomain\": \"$response.securityDomain$\",\n    \"home_domain\": \"$response.home_domain$\",\n    \"company_id\": \"$response.company_id$\",\n    \"home_company_id\": \"$response.home_company_id$\",\n    \"jobtype_id\": \"$response.jobtype_id$\",\n    \"location_id\": \"$response.location_id$\",\n    \"timezone_id\": \"$response.timezone_id$\",\n    \"securityRoles\": \"$response.securityRoles$\",\n}"
                },
                "customAuthUrl": null,
                "paginationSteps": null,
                "responseCode": null,
                "resMappingObj": null,
                "contextUrl": "/v1/people/username=$response.username$?type=internal",
                "pagingSize": 50,
                "curlEnabled": false,
                "header": {
                    "SabaCertificate": "$application.SabaCertificate$"
                },
                "operationType": "Update Account",
                "beforeRule": "WebServiceBeforeOperationRule-UpdateAccount2",
                "xpathNamespaces": null,
                "parentEndpointName": null
            }

Hi @udayputta

thanks for your response, I have done both, please check my message below on both the Operations.

There was a unwanted comma at the end which could have made your JSON as invalid. Could you try the following the JSON?

I just removed the unwanted comma with no other changes.

{
    "username": "$response.username$",
    "fname": "$plan.fname$",
    "lname": "$plan.lname$",
    "title": "$response.title$",
    "password": "$response.password$",
    "gender": "$response.gender$",
    "country": "$response.country$",
    "status": "$response.status$",
    "email": "$response.email$",
    "person_type": "$response.person_type$",
    "started_on": "$response.started_on$",
    "terminated_on": "$response.terminated_on$",
    "person_no": "$response.person_no$",
    "workphone": "$response.workphone$",
    "job_title": "$response.job_title$",
    "is_manager": "$response.is_manager$",
    "special_user": "$response.special_user$",
    "associations": "$response.associations$",
    "customValues": "$response.customValues$",
    "manager_id": "$response.manager_id$",
    "securityDomain": "$response.securityDomain$",
    "home_domain": "$response.home_domain$",
    "company_id": "$response.company_id$",
    "home_company_id": "$response.home_company_id$",
    "jobtype_id": "$response.jobtype_id$",
    "location_id": "$response.location_id$",
    "timezone_id": "$response.timezone_id$",
    "securityRoles": "$response.securityRoles$"
}

Nice catch! I removed the comma, yet still the body is empty.

1 Like

If the body if fully empty than I believe none of the mapping is actually setting any value and is getting discarded. Could you try adding a static key value pair in the JSON alongside the existing one?

"comment": "Request to update the user account"

I tried this, did not work. However, if I am sending values on “form-data” instead of raw, I am able to see the body on the requestEndpoint object. However, it is not being accepted by the target. therefore, I think we must send “raw” data.

I am not able to think of any issues which could give empty body in case of JSON but retains in case of form-data.

Whenever you have sometime, could you provide these rules:

  • WebServiceBeforeOperationRule-GetObjectUpdateAccount1
  • WebServiceBeforeOperationRule-UpdateAccount2

Also, could you get the latest operations for both Update Account 1 & Update Account 2?

I’ll try to mimic the same.

Update Account 1:

{
                "httpMethodType": "GET",
                "pagingInitialOffset": 0,
                "sequenceNumberForEndpoint": "11",
                "uniqueNameForEndPoint": "Update Account 1 (Get Object)",
                "curlCommand": null,
                "rootPath": null,
                "body": {
                    "bodyFormData": null,
                    "jsonBody": null,
                    "bodyFormat": "raw"
                },
                "customAuthUrl": null,
                "paginationSteps": null,
                "responseCode": null,
                "resMappingObj": {
                    "associations": "associations",
                    "country": "country",
                    "gender": "gender",
                    "homephone": "homephone",
                    "date_of_birth": "date_of_birth",
                    "person_type": "person_type",
                    "ss_no": "ss_no",
                    "mname": "mname",
                    "jobtype_id": "jobtype_id",
                    "title": "title",
                    "location_id": "location_id",
                    "securityRoles": "securityRoles",
                    "job_title_type": "job_title_type",
                    "lname": "lname",
                    "password": "",
                    "manager_id": "manager_id",
                    "started_on": "started_on",
                    "workphone": "workphone",
                    "id": "id",
                    "job_title": "job_title",
                    "email": "email",
                    "customValues": "customValues",
                    "securityDomain": "securityDomain",
                    "fname": "fname",
                    "company_id": "company_id",
                    "terminated_on": "terminated_on",
                    "is_manager": "is_manager",
                    "person_no": "person_no",
                    "special_user": "special_user",
                    "home_company_id": "home_company_id",
                    "timezone_id": "timezone_id",
                    "home_domain": "home_domain",
                    "status": "status",
                    "username": "username"
                },
                "contextUrl": "/v1/people/username=$getobject.nativeIdentity$?type=internal",
                "pagingSize": 50,
                "curlEnabled": false,
                "header": {
                    "SabaCertificate": "$application.SabaCertificate$"
                },
                "operationType": "Update Account",
                "beforeRule": "WebServiceBeforeOperationRule-GetObjectUpdateAccount1",
                "xpathNamespaces": null,
                "parentEndpointName": null
            }

Update Account 2:

{
                "httpMethodType": "PUT",
                "pagingInitialOffset": 0,
                "sequenceNumberForEndpoint": "12",
                "uniqueNameForEndPoint": "Update Account 2 (Update Object)",
                "curlCommand": null,
                "rootPath": null,
                "body": {
                    "bodyFormData": null,
                    "jsonBody": "{\n&quot;fname&quot;: &quot;$plan.fname$&quot;,\n&quot;lname&quot;: &quot;$plan.lname$&quot;,\n&quot;username&quot;: &quot;$response.username$&quot;,\n&quot;title&quot;: &quot;$response.title$&quot;,\n&quot;password&quot;: &quot;$response.password$&quot;,\n&quot;gender&quot;: &quot;$response.gender$&quot;,\n&quot;country&quot;: &quot;$response.country$&quot;,\n&quot;status&quot;: &quot;$response.status$&quot;,\n&quot;email&quot;: &quot;[email protected]&quot;,\n&quot;person_type&quot;: &quot;$response.person_type$&quot;,\n&quot;started_on&quot;: &quot;$response.started_on$&quot;,\n&quot;terminated_on&quot;: &quot;$response.terminated_on$&quot;,\n&quot;person_no&quot;: &quot;$response.person_no$&quot;,\n&quot;workphone&quot;: &quot;$response.workphone$&quot;,\n&quot;job_title&quot;: &quot;$response.job_title$&quot;,\n&quot;is_manager&quot;: &quot;$response.is_manager$&quot;,\n&quot;special_user&quot;: &quot;$response.special_user$&quot;,\n&quot;associations&quot;: &quot;$response.associations$&quot;,\n&quot;customValues&quot;: &quot;$response.customValues$&quot;,\n&quot;manager_id&quot;: &quot;$response.manager_id$&quot;,\n&quot;securityDomain&quot;: &quot;$response.securityDomain$&quot;,\n&quot;home_domain&quot;: &quot;$response.home_domain$&quot;,\n&quot;company_id&quot;: &quot;$response.company_id$&quot;,\n&quot;home_company_id&quot;: &quot;$response.home_company_id$&quot;,\n&quot;jobtype_id&quot;: &quot;$response.jobtype_id$&quot;,\n&quot;location_id&quot;: &quot;$response.location_id$&quot;,\n&quot;timezone_id&quot;: &quot;$response.timezone_id$&quot;,\n&quot;securityRoles&quot;: &quot;$response.securityRoles$&quot;\n}",
                    "bodyFormat": "raw"
                },
                "customAuthUrl": null,
                "paginationSteps": null,
                "responseCode": null,
                "resMappingObj": null,
                "contextUrl": "/v1/people/username=$response.username$?type=internal",
                "pagingSize": 50,
                "curlEnabled": false,
                "header": {
                    "SabaCertificate": "$application.SabaCertificate$"
                },
                "operationType": "Update Account",
                "beforeRule": "WebServiceBeforeOperationRule-UpdateAccount2",
                "xpathNamespaces": null,
                "parentEndpointName": null
            }

I replaced " with &quot; now, still didn’t work.

The rules are just for printing.

Here are the rules:

WebServiceBeforeOperationRule-UpdateAccount2:

\n\nimport java.util.*;\nimport java.util.HashMap;\nimport java.util.List;\nimport sailpoint.object.ProvisioningPlan;\nimport sailpoint.object.Identity;\nimport sailpoint.object.ProvisioningPlan.AccountRequest;\nimport sailpoint.object.ProvisioningPlan.AttributeRequest;\nimport sailpoint.object.QueryOptions;\nimport sailpoint.object.Filter;\nimport connector.common.JsonUtil;\nimport org.json.JSONObject;\nString ruleName = \"WebServiceBeforeOperationRule-UpdateAccount2\";\nlog.warn(ruleName + \" - ENTRY\");\nif(provisioningPlan != null){log.warn(ruleName + \" - provisioningPlan - source = \" + provisioningPlan.getSource());}\nlog.warn(ruleName + \" - requestEndPoint before = \" + requestEndPoint);\nList attrnameList = new ArrayList();\nattrnameList.add(\"fname\");\nattrnameList.add(\"lname\");\nattrnameList.add(\"email\");\nattrnameList.add(\"workphone\");\nattrnameList.add(\"person_no\");\nlog.warn(ruleName + \" - attrnameList = \" + attrnameList);\nIdentity id = provisioningPlan.getIdentity();\nlog.warn(ruleName + \" - identity = \" + id);\nString nativeIdentity = \"\";\nList accreqs = provisioningPlan.getAccountRequests();\nMap newvals = new HashMap();\nfor(AccountRequest ar:accreqs){if(ar !=null){nativeIdentity = ar.getNativeIdentity();}\nlog.warn(ruleName + \" - nativeIdentity = \" + nativeIdentity);List attrs = ar.getAttributeRequests();String attrname = \"\";String attrval= \"\";for (AttributeRequest at:attrs){if (!at.getName().equalsIgnoreCase(\"group\")){attrname = at.getName();\nattrval = at.getValue();newvals.put(attrname,attrval);}}}log.warn(ruleName + \" - nativeIdentity = \" + nativeIdentity);log.warn(ruleName +\" - newvals = \" + newvals);log.warn(ruleName + \" - EXIT\");return requestEndPoint;

WebServiceAfterOperationRule-GetObjectUpdateAccount1

\n\nimport java.util.*;\nimport java.util.HashMap;\nimport java.util.List;\nimport org.apache.http.cookie.Cookie;\n \nlog.warn(\"Rule - WebServiceAfterOperationRule-GetObjectUpdateAccount1 | Start the rule\");\n \nlog.warn(\"WebServiceAfterOperationRule-GetObjectUpdateAccount1 | Print requestEndPoint: \"+requestEndPoint);\n\nlog.warn(\"WebServiceAfterOperationRule-GetObjectUpdateAccount1 | Print rawResponseObject: \"+rawResponseObject);\n\nlog.warn(\"WebServiceAfterOperationRule-GetObjectUpdateAccount1 | Print restClient: \"+restClient);\n\nMap returnMap = new HashMap();\n\nlog.warn(\"WebServiceAfterOperationRule-GetObjectUpdateAccount1 | End rule\");\n\nreturn returnMap;\n\n

Also, thanks for your time :slight_smile:

hi @tamalika01

at this log statement what are you seeing after making the change suggested by @zeel_sinojia,

log.warn(ruleName + " - requestEndPoint before = " + requestEndPoint);

Also in your before operation rule you are getting group details form plan but not sending it anywhere. I believe this is still not complete.

Can you remove redundant code from the rule and try it out once.

Thanks,
Uday

1 Like

Hi @udayputta

I have removed now all before and after rules. only printing the requestEndPoint for the final Update operation and the body is still empty. This is strange behavior in my opinion. I had faced this similar issue a couple of years ago while working on a WS connector on IIQ and had to write a BeforeOperation rule to formulate the reuqest body again. I was not expecting to do this again now on IDN :slight_smile:

Anyways, thanks a lot for the help @zeel_sinojia & @udayputta .

Warm regards
Tamaika

Yes you have to use before operation rule. IDN is built on same connector which is used in IIQ. so i would assume same functionality applicable to ISC.

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