Getting Error "Problems parsing JSON" while making POST call to create tree

"base_tree": “2267699d5ea2a632c625693ceef5f7b77b2cda74”,
"tree": [
                   “path”: “synthetics/MyAccount-MakeAPayment.js”,
                   “mode”: “100644”,
                    “type”: “blob”,
                    “content” : "require(‘new-relic-synthetics-manager’);





I have more lines to be included in the content property(more than 100 lines of the script which contains " and ').  Even at the first line, it is failing whenever there is a newline character. Please let me know how can I provide some scripts (javascript/selenium scripts) in the content property of the api call for creating a tree as mentioned in the documentation Please note that I am trying to modify multiple files and commit all my changes at a single shot so won’t be able to use  Content APi as mentioned in the documentation
Some help at the earliest will be greatly appreciated.

Thanks in Advance


Thanks for reaching out! And apologies about the delay. Are you still experiencing this issue?

Hi, I’m having a similiar problem…

I have about 300 files to update, using content api isn’t acceptable due to rate/abuse limiting (I originally tried this creating a blob for each file using base64 encoding, then adding to tree via SHA)

Using I’m now trying to use “content” vs “sha” and create the whole tree in one shot (which although technically works) it’s posting all my files as the base64 encoded string vs decoding them.

For lots of reasons like above, I can’t put the raw string inside the JSON.  I tried adding encoding to the json in hopes it would work but it doesn’t.  Is there a reason create tree content doesn’t default/use base64 encoding?

Sample JSON creation:

‘{ “path”: "’ + path + macroName + “.macro” + ‘", “mode”: “100644”, “type”: “blob”, “content”: "’ + macroEncoded + ‘", “encoding”: “base64” }’

1 Like