Srene
HTTPosion request format
Hi…
I have the following in python:
response = requests.post(url,data=parameters, auth=(api_key, ‘’))
What is the HTTPoison ot HTTPotion equivalent for this.
Thanks.
Most Liked
NobbZ
Please do not assume that anyone does know what a certain snippet in a foreign language does. Please try to explain how the request should look like.
collegeimprovements
HTTPoison is cool but take a look at Tesla also.
Link: https://github.com/teamon/tesla
Documentation: https://hexdocs.pm/tesla/api-reference.html
markkauffman2000
HTTPoison POST Example. Auth goes into the trailing options.
post!(url, body, headers \\ [], options \\ [])
iex(7)> {code, response} = HTTPoison.post "https://bd-partner-a-system.blackboard.com/learn/api/public/v1/oauth2/token", "grant_type=client_credentials", [{"Content-Type", "application/x-www-form-urlencoded"}], [hackney: [basic_auth: {"user", "password"}] ]
The code is :ok, or not. The response will be an %HTTPoison.Response
HTTPotion POST Example. Most everything, including auth, goes into options.
response = HTTPotion.post(url, options \\ [])
iex(2)> options = [body: "grant_type=client_credentials",
headers: ["Content-Type": "application/x-www-form-urlencoded"],
basic_auth: {"user","password"}]
iex(3)>response = HTTPotion.post("https://bd-partner-a-system.blackboard.com", options)
The response will be an %HTTPotion.Response.
Docs are easily found with a search. Between the docs you find and the above examples, you should be set!







