Issue
I am trying to construct a curl request that will allow me to automate the task of attaching a binary to a release in GitHub (so dragging a file into the box).
From the API docs I can see that we need to obtain the id of the release (which I have already obtained from a prior call):
https://developer.github.com/v3/repos/releases/#upload-a-release-asset
At the moment I get
curl --header {"Content-Type": "application/zip"} --data \'{"name": "path_to_zip_file"} "https://api.github.com/repos/owner/my_repo/releases/:id/assets?access_token=acces_token"
I get a response like with a lot of other
Hello future GitHubber! I bet you're here to remove those nasty inline styles, DRY up these templates and make 'em nice and re-usable, right?`
<p><strong>We didn't receive a proper request from your browser.</strong></p>
Solution
You send JSON payload in your request, but the docs you linked say you need to make a POST request with the raw binary file contents as payload.
Also you miss to set the Content-Type
header correctly.
Change your curl
call to supply the file as payload, add the filename as parameter to the URL and set the header like described in the docs and it should work fine.
The resulting command should be something like: curl 'https://api.github.com/repos/owner/my_repo/releases/:id/assets?access_token=acces_token&name=foo.zip' --header 'Content-Type: application/zip' --upload-file test.zip -X POST
Answered By - Vampire Answer Checked By - David Goodson (WPSolving Volunteer)