New topic Closed topic
avatar image
0
posting JSON to the Betty Blocks API
By Created , last editted

Hi,


I've use Postman to post data to API, which works fine as described in the documentation.

These posts use form-data like in record[lastname]=Janssen

I can mimic this in Curl like this.

curl --user username:apikey -i -H "Content-Type: application/x-www-form-urlencoded" --data "record[firstname]=jan&record[lastname]=jansen" -X POST https://myapp.bettyblock...

That works fine.

But I don't succeed in using json as the data load, like in:

curl --user username:apikey -i -H "Content-Type: application/json" --data "{'firstname':'jan'}" -X POST https://myapp.bettyblock...

I tried various notation of the json.

Am I missing something?

Hans



Hi,


I've use Postman to post data to API, which works fine as described in the documentation.

These posts use form-data like in record[lastname]=Janssen

I can mimic this in Curl like this.

curl --user username:apikey -i -H "Content-Type: application/x-www-form-urlencoded" --data "record[firstname]=jan&record[lastname]=jansen" -X POST https://myapp.bettyblock...

That works fine.

But I don't succeed in using json as the data load, like in:

curl --user username:apikey -i -H "Content-Type: application/json" --data "{'firstname':'jan'}" -X POST https://myapp.bettyblock...

I tried various notation of the json.

Am I missing something?

Hans


Answers
Sort by:

This topic is closed.