Data Broker Server Script: Syntax error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 09:45 PM
I have written a Transform Data resource to fetch JSON data using Rest API with the following code:
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://dummyjson.com/products/1');
request.setHttpMethod('GET');
request.setRequestHeader("Accept", "application/json");
var response = request.execute();
gs.log(response.getBody());
When I run this transform script, it throws syntax error as follows:
"sourceName": "sys_ux_data_broker_transform.f41c85c7871e0910afa7206f8bbb3597",
"lineNumber": 1,
"lineSource": "(var request = new sn_ws.RESTMessageV2();",
"columnNumber": 5,
"errorMessage": "syntax error",
"name": "SyntaxError",
"message": "syntax error",
"localizedMessage": "syntax error",
"scriptStackTrace": "",
"scriptStack": [],
"suppressed": []
},
"logMessage": "Data Broker Server Script: 'Test Jamshaid' : Line(1) column(5)\n(var request = new sn_ws.RESTMessageV2();",
"name": "SyntaxError",
"message": "syntax error",
"lineNumber": 1,
"localizedMessage": "syntax error",
"suppressed": []
}
]
I am unable to get what is wrong with my script. Could anyone please help me figure this out? Thanks
- Labels:
-
Script Debugger
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2022 09:14 PM
I think it could be a scope issue.
I see you are in the application scope called Test 1. Can you check if there is any Restricted Caller Access Privilege record asking for 'Allowed' permission
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 08:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2022 04:43 AM
the 1st line should be:
function transform(input) {
I will always try to give a meaningful and valid answer.