1

I have command (line-breaks added between command-line parameters for readability):

curl
    -s
    --form-string "token=AppToken"
    --form-string "user=UserToken"
    --form-string "message=Msg"
    --form-string "title=Title" 
    https://api.pushover.net/1/messages.json

Can you tell me if this command can be converted into a URL link?

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Tema
  • 11
  • 1

1 Answers1

1

Can you tell me if this command can be converted into a url link?

It cannot.

  • That curl command is for a POST with an application/x-www-form-urlencoded request body.
  • "Links" are always GET requests and never for POST requests.
    • <a href="#"> links in HTML and the web can only make GET requests without a request-body (at least, not without custom JavaScript interception).
    • In desktop software frameworks and toolkits (that have built-in Hyperlink widgets), I find (in my personal experience) that they're similarly designed around the assumption they'll be used to open a URL to a web-page and so pass the URL to the user's default browser, which will only make a GET request.
    • This is because following a link (i.e. executing a GET request) must always be "safe" (i.e. GET requests should not mutate resource state).
  • Additionally, "Links" cannot have a request body.
    • Though while GET requests can (technically) have a request-body, support for that is not widespread; and obviously single URIs for hyperlink GET requests don't have any request-body data associated with them.
      • GET request bodies are intended to allow user-agents to make GET requests with associated request/query data that is too long to fit into the querystring of the URI (due to the common 1024 or 2048 char limit).
Dai
  • 141,631
  • 28
  • 261
  • 374
  • Many URLs support both `GET` and `POST`, it seems like it would be worth trying it as a `GET` request. – Stephen Ostermiller Nov 29 '21 at 10:07
  • @StephenOstermiller Whether or not you _can_ make a `POST` request to a URI from a custom client or JS code or HTML `
    ` is irrelevant to the fact that a hyperlink ("link" in the OP's parlance) can only initiate bodyless `GET` requests.
    – Dai Nov 29 '21 at 10:13