=== modified file 'src/docbkx/en/dhis2_user_man_web_api.xml' --- src/docbkx/en/dhis2_user_man_web_api.xml 2014-05-30 18:30:37 +0000 +++ src/docbkx/en/dhis2_user_man_web_api.xml 2014-05-30 18:54:42 +0000 @@ -1620,6 +1620,31 @@ </message> To test this we save the XML content into a file called message.xml. We use cURL to dispatch the message the the DHIS 2 demo instance where we indicate that the content-type is XML and authenticate as the admin user: curl -d @message.xml "http://apps.dhis2.org/demo/api/messageConversations" -H "Content-Type:application/xml" -u admin:district -X POST -v + A corresponding payload in JSON and POST command look like this: + { + "subject": "Hey", + "text": "How are you?", + "users": [ + { + "id": "OYLGMiazHtW" + }, + { + "id": "N3PZBUlN8vq" + } + ], + "userGroups": [ + { + "id": "ZoHNWQajIoe" + } + ], + "organisationUnits": [ + { + "id": "DiszpKrYNg8" + } + ] +} + + curl -d @message.json "http://apps.dhis2.org/demo/api/messageConversations" -H "Content-Type:application/json" -u admin:district -X POST -v If all is well we receive a 201 Created HTTP status code. Also note that we receive a Location HTTP header which value informs us of the URL of the newly created message conversation resource - this can be used by a consumer to perform further action. We will now pretend to be the mobile user and read the message which was just sent by dispatching a GET request to the messageConversations resource. We supply an Accept header with application/xml as the value to indicate that we are interested in the XML resource representation and we authenticate as the mobile user: curl "http://apps.dhis2.org/demo/api/messageConversations" -H "Accept:application/xml" -u mobile:district -X GET -v