← Back to team overview

dhis2-devs team mailing list archive

Re: [Dhis2-users] FRED API

 

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****
>
> ** **
>
> 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://<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, 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
>
>

Follow ups

References