0

I can send this successfully using the Postman Chrome extension with RAW data as below. How do I to build a HTML form, with fields to input message/badge/status and POST the data?

POST /rest/push/msg HTTP/1.1
Host: api.appery.io
X-Appery-Push-API-Key: myKey
Content-Type: application/json
Cache-Control: no-cache
{"payload":{"message":"Rockets important message","badge":"1"},"status":"sent"} 
Rocket
  • 3
  • 2

1 Answers1

0

You can't.

There are a few ways that a form can encode data, but JSON is not currently one of them. There is a proposal to change that, but I'm not aware of any browser implementation in the wild.

Aside from that, a regular form submission doesn't support the addition of custom request headers (such as X-Appery-Push-API-Key).

If you want to make that request from a webpage, you'll have to construct it using JavaScript and send it with the XMLHttpRequest object (which would be subject to the Same Origin Policy).

Community
  • 1
  • 1
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335