ERROR on the HTTP Method Test, in a RES Message

Facundo Prado
Tera Expert

Hello everyone!
I have to make an integration, so I´ve created a REST Message with its HTTP Method. Then I´ve created a Script Include to call it.
The thing is that I need ONLY the name of the person, but I cannot filter this out.
This is the JSON im getting:
{
"id": "0000055e19e0412e",
"name": "asif.bal",
"alias": "asif.bal",
"email": null,
"status": null,
"identityState": null,
"manager": null,
"attributes": []
},

 


Filter:

FacundoPrado_0-1729545108339.png

 

ERROR:

FacundoPrado_1-1729545150627.png



Scrpt Include:

var ISCRestDataService = Class.create();
ISCRestDataService.prototype = {
    initialize: function() {

    },

    getPublicIdentities: function() {
        try {
            var restMessage = new sn_ws.RESTMessageV2('acn_myAccess_isc_oAuth2', 'getPublicIdentities');

            // Should we create this field on the table?
            //restMessage.setRequestBody(current.u_isc_payload.toString());

            var response = restMessage.execute();
            var httpStatus = response.getStatusCode();
            //var responseBody = response.getBody();

            // Logs for see the responses
            gs.info('HTTP Status: ' + httpStatus);
            gs.info('Response Body: ' + responseBody);

            /*
            if (statusCode != 200 && statusCode != 201 && statusCode != 202) {
                requestDataService.createIntegrationIncident("IIQ", "submitAccessRequest", "[IIQRestDataService] [startIIQWorkflow] IIQ Data Service Error HTTP Status: " + statusCode, gs.getUserID());
                gs.error("[IIQRestDataService] [startIIQWorkflow] IIQ Data Service Error HTTP Status: " + statusCode);
                return;
            }
            */

            return {
                status: httpStatus,
                body: responseBody
            };

        } catch (error) {
            //Copy of IIQRestDataService Script Include
            //gs.error("[IIQRestDataService] [startIIQWorkflow] IIQ Data Service Error: " + error);
            //requestDataService.createIntegrationIncident("IIQ", "submitAccessRequest", "[IIQRestDataService] [startIIQWorkflow] IIQ Data Service Error", gs.getUserID());
        };

        type: 'ISCRestDataService';
    },

}
2 REPLIES 2

aizawaken
Tera Guru

Hi @Facundo Prado ,

From the error capture, it says that the URI is invalid.
I think that it was caused by the double-quotation mark and a space before it, and it was not URL-encorded. They need to be escaped.

If you can do URL-encord before calling the API, it would be solved.
And I can see "Escape Type" is set as "No Escaping" in your Filter Capture.
If you can check that this selectbox can be used for the URL-encording purpose, you should try it.

Thanks,

Hitoshi Ozawa
Giga Sage
Giga Sage

The outbound url is probably as below.

 

https://accenture-dev.api.identitynow.com/v2024/public-identities?alias=dmetri.mezhevich

 

This implies the uril should be configured as below

 

https://accenture-dev.api.identitynow.com/v2024/public-identities?{filter}

 

variable substitution. Note that there's no space nor quotation. Double quotation is not allowed in url. API function being called probably don't require string to be double quoted.

 

alias=dmetri.mezhevich

 

 

To just get the value of the "name",

            return {
                status: httpStatus,
                body: responseBody.name
            };