Sal P. Sal P. - 4 months ago 22
JSON Question

Trying to retrieve data from an API, but I cannot connect and I do not understand the error output

I'm trying to retrieve a random quote from an API (in the form of a JSON file) using this command:

curl -v -i -X GET http://api.forismatic.com/api/1.0/method=getQuote&key=457653&format=json&lang=en


but I recieve the following output error:


[1] 4009

[2] 4010

[3] 4011

salpal@salpal-Aspire-E5-573G:~$ Error: wrong method.

[1] Done curl -X GET http://api.forismatic.com/api/1.0>
/method=getQuote

[2]- Done key=457653

[3]+ Done format=json


It says I am using the wrong method, but I am simply following the directions of the documentation specified here:

http://forismatic.com/en/api/

Does anyone know why this is happening?

Thanks!

Answer

Look like you were missing the ?.

Try http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=json&lang=en

Comments