Migrating basic http POST from Postman to streamdeck
Hi there
I'm struggling to migrate a working POST statement from POSTMAN into this plugin.
I'm using a URL with an API appended to it or should I be accommodating this differently in the plugin.
Cheers gh0st954
Sorry, that's pretty vague so I can't really help you based only on this description.
The main things that you need to need to send requests using this plugin are the URL, method, headers, and body for the request, so you should start by trying to identify what those are. It might help to look at what the generated curl command looks like. API documentation will also usually explain how your headers should be set for things like authentication.
Thanks for repsonding!, Apologies if I was too vague. Not sure if I could post code or use DM.
My curl output looks like this:
curl --location --request POST 'https://localhost:56789/streamdeck14?apikey=BIGLONGAPIKEY'
--header 'Content-Type: application/json'
--data-raw '{
"Message2": "Pressed"
}'
If I use HTTP code output it picks up extra headers:
POST /streamdeck14?apikey=BIGLONGAPIKEY HTTP/1.1 Host: localhost:56789 Content-Type: application/json Content-Length: 31
{ "Message2": "Pressed" }
I'm not sure where I am going wrong here at all. I've added headers on separate lines as per instructions. I'm wondering if it might be SSL rejection or the port?
https://localhost:56789/streamdeck14?apikey=BIGLONGAPIKEY should be your URL, POST would be your method, you shouldn't need to input any headers as long as you choose application/json from the content type dropdown, and { "Message2": "Pressed" } would be your body.
This plugin uses the fetch API to send requests, so as a way of troubleshooting you could try exporting JavasScript fetch code from Postman and pasting that into your browser's developer console.
Thanks Adrian, yeah this has me baffled! If I post the javascript Fetch code snippet into Chrome Developer console shows no issues although I can't execute it... trying to work on that at the moment.