how to make queries passing 2 parameters via Curl?

Asked

Viewed 1,076 times

1

I need to send via Curl a user and a password in txt same, it is only for test, for example

Curl -v -H "Accept: application/json" -H "Content-type: application/json" http://127.0.0.1/Students/

I want to pass the user and a password in this query, someone can help

is GET , I need to pass the parameters because a method will consult the bank and see if it is valid.

  • then what if you pass the parameters directly to the URL: curl -v -H "Accept: application/json" -H "Content-type: application/json" http://127.0.0.1/students/PARAM1/PARAM2?

  • then but in the method I have other parameters that I can receive, like, I can receive 4 parameters, but I will pass only 2, how to identify which of these 4 parameters available I am sending via Curl ?

  • But is that a login? Shouldn’t be going through post as is immensely recommended?

1 answer

1

An example like sending in json format:

   curl -H "Content-Type: application/json" -X POST -d '{"usuario":"foo","senha":"bar"}' http://127.0.0.1/students/

usuario and senha are the names of the parameters.
foo and bar are their reflective values.

  • wonderful, but let me ask, if I send via POST it will not make an insert ?

  • not necessarily... what defines what will occur is the application and not the sending method..... an "Insert" can be done even with GET method

Browser other questions tagged

You are not signed in. Login or sign up in order to post.