Skip to content

Instantly share code, notes, and snippets.

@wolves
Last active April 1, 2022 14:05
Show Gist options
  • Save wolves/3b13903ef8c8322b191c3510334cff90 to your computer and use it in GitHub Desktop.
Save wolves/3b13903ef8c8322b191c3510334cff90 to your computer and use it in GitHub Desktop.
Elixir curl Github API
repo_data = [name: "asdf"]
{status, result} = JSON.encode(repo_data)
IO.puts "RESULT: #{result}"
case System.cmd "curl", ["-XPOST", "-H", "Authorization: token #{github_token}", "https://api.github.com/user/repos", "-d", "#{result}"] do
{output, 0} -> IO.puts "#{output}"
{err, code} -> {:error, %Raygun.Error{message: err, command: "new", code: code}}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment