← Back to team overview

dhis2-users team mailing list archive

Re: FRED API

 

When you get these 400 errors, ot might be a good idea to use
jsonlint.orgto 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****
>>
>> ** **
>>
>> 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