0

I'm attempting to send some data via a GET request in SSJS on a CloudPage. The code below is throwing a 500 server error. I'm assuming that means there's something wrong with the syntax but I can't figure out what that would be.

This is what my API documentation says the request should look like, and I guess I'm just having trouble converting it to the format of the SSJS function:

GET /WS/Interaction.asmx/IssueInteractionUserDefined?WSSecurityToken=string&MemberAccountId=string&SBInternalMemberId=string&InteractionTypeExternalReference=string&LocationExternalReference=string&InteractionNote=string HTTP/1.1
Host: app.domain.com
var email = Request.GetQueryStringParameter("e");
var url = 'https://app.domain.com/WS/Interaction.asmx/IssueInteractionUserDefined';
var interaction = 'Dec2021-Survey';
var headers = ['WSSecurityToken','MemberAccountId','SBInternalMemberId','InteractionTypeExternalReference','LocationExternalReference','InteractionNote'];
var values = ['token',email,'-1',interaction,'Sales_Force',''];
var response = HTTP.Get(url, headers, values);
Write(response.Status + '<br />');
Write(response.Content);

Error Message:

"An error occurred when attempting to evaluate a HTTPGet function call. See inner exception for details.\r\n ClientID: 6252256\r\n JobID: 0\r\n ListID: 0\r\n BatchID: 0\r\n SubscriberID: 0\r\n URL: https://app.domain.com/WS/Interaction.asmx/IssueInteractionUserDefined\r\n"

Description:

"ExactTarget.OMM.FunctionExecutionException: An error occurred when attempting to evaluate a HTTPGet function call. See inner exception for details.\r\n ClientID: 6252256\r\n JobID: 0\r\n ListID: 0\r\n BatchID: 0\r\n SubscriberID: 0\r\n URL: https://app.domain.com/WS/Interaction.asmx/IssueInteractionUserDefined\r\n Error Code: OMM_FUNC_EXEC_ERROR\r\n - from OMMCommon --> \r\n\r\n --- inner exception 1---\r\n\r\nExactTarget.OMM.OMMException: An exception occurred when attempting to retrieve content by a HttpGet call. URL: https://app.domain.com/WS/Interaction.asmx/IssueInteractionUserDefined\r\n Error Code: HTTP_WB_RTV\r\n - from OMMCommon --> \r\n\r\n --- inner exception 2---\r\n\r\nSystem.Net.WebException: The remote server returned an error: (500) Internal Server Error. - from System\r\n\r\n\r\n\r\n\r\n\r\n"

1
  • 2
    Not positive why this was closed, it is about using a SSJS function inside of SFMC. They were having trouble with the syntax of the function and asking for help. Please someone explain how this is not exactly the point of this site? Dec 17, 2021 at 14:49

1 Answer 1

1

HTTP GET passes the information via Query String - like you see in your example. (the part after the ?). So what you are sending via the headers in the Http.Get function is incorrect and likely causing the error.

You will need to append all these values to your URL like the example.

E.g.

?WSSecurityToken=string&MemberAccountId=string&SBInternalMemberId=string&InteractionTypeExternalReference=string&LocationExternalReference=string&InteractionNote=string

will be added on to the base url you have. You just add in the variables to the appropriate places in the URL.

2
  • That's what I thought! But the HTTP Get function has required parameters for the request header and values. What would I put there?
    – K K
    Dec 16, 2021 at 17:25
  • 1
    @KK - Only the URL is required, the header/values parameters are optional, so do not need to include. Dec 17, 2021 at 14:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .