Hi, I’m trying to write a translation script for an Option List to decode the “content” part, encoded in base64, of a file requested from GitLab.
Response if curl command is executed from shell console:
{
"file_name": "test.txt",
"file_path": "test.txt",
"size": 55,
"encoding": "base64",
"content_sha256": "xxxxxxxxxxxxxxxxxxxxxxx",
"ref": "master",
"blob_id": "xxxxxxxxxxxxxxxxxxxxxxx",
"commit_id": "xxxxxxxxxxxxxxxxxxxxxxx",
"last_commit_id": "xxxxxxxxxxxxxxxxxxxxxxx",
"execute_filemode": false,
"content": "eyJmcnVpdCI6eyJuYW1lIjoiYXBwbGUiLCJjb2xvciI6ImdyZWVuIiwicHJpY2UiOjEuMjB9fQ=="
}
Decoded “content” is: {“fruit”:{“name”:“apple”,“color”:“green”,“price”:1.20}}
OPTION LIST configuration is as follow:
SOURCE URL: https://< Git server name >/api/v4/projects/17/repository/files/test.txt?ref=master
IGNORE SSL: checked
ADD HEADER:
- NAME: PRIVATE-TOKEN
- VALUE: < token >
TRANSLATION SCRIPT:
var jsontmp = atob(data.content)
results = jsontmp.fruit
If I click “SAVE CHANGES” in Option List I get error “atob is not defined”
How can I add atob to use in my translation script?
Thanks in advance!