curlkaa

How possible send notification with using curl command, without file in Kaa?


I want send notification without file in the curl command.

And then, this is my curl command with file :

curl -v -S -u devuser:devuser123 -X POST --header 'Content-Type:multipart/form-data' -F'notification={"applicationId":"3","schemaId":"65564","topicId":"2","type":"USER"};type=application/json' --header 'Accept:application/json' 'http://192.168.10.49:8080/kaaAdmin/rest/api/sendNotification' -F file=@notification.json

How possible send notification without using the file (with message body in curl command ?!)


Solution

  • Try the following command:

    echo '{ ...your notification... }' | curl -v -S -u devuser:devuser123 -X POST --header 'Content-Type:multipart/form-data' -F'notification={"applicationId":"3","schemaId":"65564","topicId":"2","type":"USER"};type=application/json' --header 'Accept:application/json' 'http://192.168.10.49:8080/kaaAdmin/rest/api/sendNotification' -F file=@-
    

    @- instructs curl to read data from stdin.

    This answer is adapted from this question.