dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23502
Re: [Dhis2-users] FRED API
Hi, you are absolutely right, thanks for the tip.
Regards,
Paulo Grácio
From: Morten Olav Hansen [mailto:mortenoh@xxxxxxxxx]
Sent: quinta-feira, 18 de Julho de 2013 12:29
To: Paulo Grácio
Cc: DHIS 2 developers; dhis2-users
Subject: Re: [Dhis2-users] FRED API
When you get these 400 errors, ot might be a good idea to use jsonlint.org to check your json
On Jul 18, 2013 5:26 PM, "Morten Olav Hansen" <mortenoh@xxxxxxxxx> wrote:
Hi, json requires properly quoted key. So you need to use "name": ""
On Jul 17, 2013 6:04 PM, "Paulo Grácio" <pgracio@xxxxxxxxxxxxxxxxxxxx> wrote:
Hi there,
I was trying to get started with FRED API following the documentation that can be found here
<http://www.dhis2.org/doc/snapshot/en/user/html/ch25s21.html> http://www.dhis2.org/doc/snapshot/en/user/html/ch25s21.html
Get all facilities or Get a specific facility based on either UID or UUID I already can do, but I'm struggling to create a new Facility. The example has
curl -u username:password -X POST -d @new_facility.json -H "Content-Type: application/json" http:// <http://%3cserver-url%3e/api-fred/v1/facilities.json> <server-url>/api-fred/v1/facilities.json
but I couldn’t find the content of the file new_facility.json. Based on specification, <http://facilityregistry.org/#create-facility> http://facilityregistry.org/#create-facility, we only need to specify facility name like this:
{
name: "Kakamega HC"
}
Running
curl -u admin:district -X POST -d @demo.json -H "Content-Type: application/json" http://localhost:8081/api-fred/v1/facilities.json
I’m getting always Error 400 - the request sent by the client was syntactically incorrect.
Kind regards,
Paulo Grácio
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp
References