I downloaded an Android Rest client but the problem is that I do not know how or what to post using this. I know the curl -X -H … stuff. That works in the commandline well however I want to use this client. I tried bunch of headers post stuff without knowing what I am doing, naturally all failed ;(
The client offers POST , Http headers etc.
My question is that what kind of POST Header am I supposed to choose and do I need the body for the post?
I realize this is not necessarily a ST related questionb, but it might help others in case they want to give that method a try.
The one I am trying to use is “Rest CLient for Android”
I’m new to this as well, but I’ve had some success interacting with the REST api with Powershell. As an example, this restarts Syncthing:
$ApiKey = “ifhgrnjtwoerhtdlkfjgnfidhfg” (You find it in the settings of Syncthing)
$Url = "http://localhost:8384/rest/system/restart"
Invoke-RestMethod -Uri $Url -Method Post -Headers @{“X-API-Key” = $ApiKey}
So to answer your question: You dont always need a body. If you’re posting a config, the config is the body. But in my example, no body is posted. But the header contains the API key. But I do not know how to write the header in the rest client you are using. I would guess it’s the same format as in Curl.
Keep in mind I’m no expert at this, I’ve just started learning and experimenting myself.
The Method should generally be POST; the URL is clear I think.
Everything you addred with -H to curl are headers in form of Name:Value which you have to add inside the app. If you used the -dparameter with curl, that’s the body (I think)
If this is the app you are referring to, than the screenshot shows a Header which would be -H "Accept:application/json" when using curl.