Skip to main content
8 events
when toggle format what by license comment
Apr 7, 2021 at 6:28 comment added Zamaan Shah No git handy for this in SSJS sorry. You could look at extracting the html from the response and escaping/removing it as a workaround with something like this var html = response.match(\"content\"(.*?),\n\g) var cleanHtml = escapeHTML(html) Do you have a snippet of the code that you're using to get the response and parse it? Might be as straightforward as dropping Stringify(response.content) in there which usually does the trick but i'd have to build the code and test myself before I can be any more help
Apr 1, 2021 at 5:53 comment added Sharath Jallu The above replace logic renders well in the UI with Escape Character. But when I actually Parse the Json, its failing. Tried sending to Client JS, output isnt as expected in Json format. {"count":6,"page":1,"pageSize":50,"links":{},"items":[{"id":31762,"customerKey":"Transactional_Template3","assetType": etc.. Do you have any working Git? im running out of time :(
Apr 1, 2021 at 1:51 comment added Zamaan Shah For the Text to HTML, i'd probably play around with some functions to escape characters before you parse it, a pretty basic one could look like: function escapeHtml(unsafe) { return unsafe .replace(/&/g, "&amp;") .replace(/</g, "&lt;") .replace(/>/g, "&gt;") .replace(/"/g, "&quot;") .replace(/'/g, "&#039;"); } var cleanResponse = escapeHTML(response); Might have to play around with it given its in SSJS until you can properly escape everything, theres more sophisticated ways to this outside of MC but this should work within SSJS
Apr 1, 2021 at 1:48 comment added Zamaan Shah You can sort by 'createdDate' and any other attributes the system stores, best to look at the names they're returned as in the response. You can use the Page object to specify how many results you need and to iterate/paginate: "page": { "page":1, "pageSize":50 }
Mar 30, 2021 at 7:10 comment added Sharath Jallu Another Challenging issue is reading the Content of API Response as Text. The Response in the API is Raw HTML without any Escape characters. JSON Parsing is failing. Where as the same API in Postman gives Raw HTML with Escape. Btw, I'm making API call from SSJS. Hope this shouldn't be an issue.
Mar 30, 2021 at 4:28 comment added Sharath Jallu I have started the build using Content Builder API. Rather than 2 API's, I have iterated on single API call to filter out the required folders. Just wondering is there any sort function based on Last modified date or created date in the Rest API advanced query ? Is there any option to Limit rows returned too ? I tried below but getting field exception. ` "sort": [{ "property": "Created", "direction": "DESC" }] "sort": [{ "property": "Created_Date", "direction": "DESC" }] `
Mar 22, 2021 at 22:31 review First posts
Mar 23, 2021 at 0:40
Mar 22, 2021 at 22:30 history answered Zamaan Shah CC BY-SA 4.0