I am trying to use the Firebase REST API to store data in my data warehouse. I tried with jQuery and vanilla JS XHR. However, both give the same error. 403 Bad request and this answer:
Invalid data failed to parse JSON object, array or value. You may be using invalid characters in your key names.
Here is my JSON example, I'm trying to save:
{ "date": "2pm", "name": "John" }
Here is an example ajax request:
jQuery.ajax({ accept: "application/json", type: 'POST', contentType: "application/json; charset=utf-8", dataType: "json", url: "https://something.firebaseio.com/endpointnode.json", data: { "name": "John", "date": "2pm" }, });
Response to the request:
{ "error" : "Invalid data; couldn't parse JSON object, array, or value. Perhaps you're using invalid characters in your key names." }
As you can see, there are no special characters or anything else. It should just work.
It works great with CURL and Httpie. I tried checking the -v in Httpie for details. I put all the headers like Httpie. Nothing helped. By the way, my environment is writable, so there should not be any resolution problems.
Any idea how to achieve this?
Thanks.
Hakan source share