Skip to content

Instantly share code, notes, and snippets.

@olieidel
Last active November 12, 2016 14:23
Show Gist options
  • Save olieidel/1e37926b22f15a0b2bc81902dc54951d to your computer and use it in GitHub Desktop.
Save olieidel/1e37926b22f15a0b2bc81902dc54951d to your computer and use it in GitHub Desktop.
# trying to create an auth request with the microsoft cognitive
# services translator api.
# as seen here: http://docs.microsofttranslator.com/oauth-token.html
# endpoint in question (POST): https://api.cognitive.microsoft.com/sts/v1.0/issueToken
url = "https://api.cognitive.microsoft.com/sts/v1.0/issueToken"
HTTPoison.post! url, "" # empty POST request, no headers
# yields:
# iex> ** (HTTPoison.Error) :closed
# (httpoison) lib/httpoison.ex:66: HTTPoison.request!/5
# also, for get:
HTTPoison.get! url # simple GET request
# iex> ** (HTTPoison.Error) :closed
# (httpoison) lib/httpoison.ex:66: HTTPoison.request!/5
# similar results using HTTPotion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment