Webservice Connector - Special Character URL encoding

Hi,

We have integrated IIQ with with a cloud application using the Webservice Connector. We are calling the OOTB admin APIs for provisioning and deprovisioning users.
There is a GET operation to find the Organization ID by providing the Organization name saved in Identity attribute in the filter which is as below:

If Organization name is “ASCEND”, the GET call looks like this:
https://pc-xxx-gwcp.ggg.alpha3-butterfly.guidewire.net/rest/admin/v1/organizations?filter=name:eq:ASCEND

The above url works perfectly fine and returns the response back. If the Organization name has an ampersand “&” for eg: “MKE&DOWELL”, the url sent is:
https://pc-xxx-gwcp.ggg.alpha3-butterfly.guidewire.net/rest/admin/v1/organizations?filter=name:eq:MKE%26DOWELL
This above url gives an error as below: Exception occurred while performing ‘Modify’ operation on identity ‘UXLEDS’: Error: {“status”:400,“errorCode”:“gw.api.rest.exceptions.BadInputException”,“userMessage”:“There were unknown query parameter names”,“properties”:{“possibleHttpQueryKeys”:“‘filter’,‘include’,‘includeTotal’,‘pageOffset’,‘pageSize’,‘sort’,‘fields’”},“details”:[{“message”:“Unknown query parameter ‘DOWELL’”}]}

Both the urls above, works fine and gives a response back when it is run through a postman request. Any way to make this work?

Hi @prajna_poojari

What is the URL that is passed in your end point. Add some loggers in your WSBO Rule.

My guess is that it is not converting & to %26 automatically. You need to convert in the Rule. URL considers & as separator for params you pass in your request. That is why it says DOWELL is unknown query parameter. Can you check this ?

Thanks
Krish

Hello Prajna,

This stackoverflow link describes what & represents in a URL - What do a question mark (?) and an ampersand (&) mean in a URL? - Stack Overflow.
When used as part of a URL, ? and & represent key value pairs that make up the Query String, which is a set of information sent to the server.

The query string starts after the end of the page being requested with a ? and then a key value pair like:

?variable1=value1

Any additional key/value pairs need to be prefaced with & like:

?variable1=value1&variable2=value2&variable3=value3

If the value, MKE&DOWELL in the URL is passed as is without percent - encoding then it will be treated as a seperate query param/variable. Make sure the value sent from SailPoint has %26 in place of &. Make sure to print the requestEndPoint object in the before operation rule and verify is the value is encoded.

Thanks Krishna for the reply.

Yes we are replacing the “&” which is saved in Identity Attribute as “&” to “%26” within the Before Rule.

Snippet of the rule looks like this:

 String orgName=idenObj.getAttribute("brokerOrganization");
      log.debug("Org Name:"+orgName);
      orgName = orgName.replaceAll("&","%26");
      log.debug("Org Name 2:"+orgName);
      requestEndPoint.setFullUrl(requestEndPoint.getFullUrl() + orgName);      
    }
  }
  log.debug("EndPoint: "+requestEndPoint);

And the log looks like this:

Inside the Create - seq 5 or Update Operation seq 10
2023-10-11T14:26:02,577 DEBUG http-nio-8080-exec-2 economical.rule.EcoGWPCBeforeRuleGetOrganisationID:-1 - Org Name:MITCHELL&WHA
2023-10-11T14:26:02,577 DEBUG http-nio-8080-exec-2 economical.rule.EcoGWPCBeforeRuleGetOrganisationID:-1 - Org Name 2:MITCHELL%26WHA
2023-10-11T14:26:02,577 DEBUG http-nio-8080-exec-2 economical.rule.EcoGWPCBeforeRuleGetOrganisationID:-1 - EndPoint: EndPoint [_afterRule=EcoGWPCAfterOperationOrganisationIdRule, _beforeRule=EcoGWPCBeforeRuleGetOrganisationID, _contextUrl=/rest/admin/v1/organizations?filter=name:eq:, _fullUrl=https://pc-xxx-xxx.eco.alpha3-butterfly.guidewire.net/rest/admin/v1/organizations?filter=name:eq:MITCHELL%26WHA, _httpMethodType=GET, _operationType=Update Account, _rootPath=data[*].attributes, _uniqueNameForEndPoint=Get Org Unit Value for Update, paginationSteps=null, pagingInitialOffset=0, pagingSize=50, _resMappingObj={name=name, id=id}, _header={Authorization=*****, Content-Type=application/json}, _body={bodyFormat=raw}, _responseCode=[2**], _sequenceNumberForEndpoint=5, xpathNamespaces={}, possibleHttpErrors={}]
2023-10-11T14:26:02,804 ERROR http-nio-8080-exec-2 connector.webservices.v2.WebServiceFacadeV2:1612 - Error performing update operation: {"status":400,"errorCode":"*****.api.rest.exceptions.BadInputException","userMessage":"There were unknown query parameter names","properties":{"possibleHttpQueryKeys":"'filter','include','includeTotal','pageOffset','pageSize','sort','fields'"},"details":[{"message":"Unknown query parameter 'WHA'"}]}
2023-10-11T14:26:02,811 ERROR http-nio-8080-exec-2 connector.webservices.v2.WebServiceFacadeV2:598 - Exception occurred in handling object request for ''KYDAKM'' for operation ''Modify''
sailpoint.connector.ConnectorException: {"status":400,"errorCode":"gw.api.rest.exceptions.BadInputException","userMessage":"There were unknown query parameter names","properties":{"possibleHttpQueryKeys":"'filter','include','includeTotal','pageOffset','pageSize','sort','fields'"},"details":[{"message":"Unknown query parameter 'WHA'"}]}
	```

Thanks Aishwarya.

We have made sure to convert the & into “%26” in the Before Rule before sending the URL request. Still get the error.

Looks good.

From you log, I see that Method Type is GET but the operation is Update. Are you using GET method inside Update Account operation ?

That is correct. We need to get the Organization ID in the Update Account Operation before using the “POST” operation

Hello Prajna, I’m making a guess here but it might be useful to encode the % sign as well. so instead of %26 you can try using %2526 by doing so, it will be doubly encoded and it will get decoded twice in the process, first from %2526 to %26 and then from %26 to &. By the time SailPoint sends the data it will be %26 which will be sent because currently it seems as if SailPoint is decoding the value before sending the request.

Source: html - What is url encoding %2526? - Stack Overflow
Might be worth a try.

Hi Aishwarya,

I tried updating the rule to as below:

 String orgName=idenObj.getAttribute("brokerOrganization");
      log.debug("Org Name:"+orgName);
      orgName = orgName.replaceAll("&","%26");
      log.debug("Org Name 2:"+orgName);
      orgName = orgName.replaceAll("%26","%2526");
        log.debug("Org Name 3:"+orgName);
      requestEndPoint.setFullUrl(requestEndPoint.getFullUrl() + orgName);  

The request endpoint looks like this after adding this:

EndPoint: EndPoint [_afterRule=EcoGWPCAfterOperationOrganisationIdRule, _beforeRule=EcoGWPCBeforeRuleGetOrganisationID, _contextUrl=/rest/admin/v1/organizations?filter=name:eq:, _fullUrl=https://pc-xxx-gwcpxxx.eco.beta1-butterfly.guidewire.net/rest/admin/v1/organizations?filter=name:eq:MITCHELL%2526WHA, _httpMethodType=GET, _operationType=Update Account, _rootPath=data[*].attributes, _uniqueNameForEndPoint=Get Org Unit Value for Update, paginationSteps=null, pagingInitialOffset=0, pagingSize=50, _resMappingObj={name=name, id=id}, _header={Authorization=*****, Content-Type=application/json}, _body={bodyFormat=raw}, _responseCode=[2**], _sequenceNumberForEndpoint=5, xpathNamespaces={}, possibleHttpErrors={}]

No longer getting the earlier error, but the response from this get is null instead of the Organization ID

Hi,

We were able to fix the issue by adding “skipEncodingDecodingUrl = true” to the application xml as suggested by SailPoint support.

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