Reputation: 656
when i try to create an github issue it gives message not found reply. and also how to send authentication headers with this. because creating issues requires user to be logged in or authenticated
curl -X POST -i -d '{"title":"my-new-repo","body":"my new issue description"}' https://api.github.com/repos/barterli/barter.li/issues
HTTP/1.1 404 Not Found
Server: GitHub.com
Date: Wed, 19 Feb 2014 07:11:33 GMT
Content-Type: application/json; charset=utf-8
Status: 404 Not Found
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1392797200
X-GitHub-Media-Type: github.beta
X-Content-Type-Options: nosniff
Content-Length: 86
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
X-GitHub-Request-Id: 6A33C772:4DE7:9FBE4E:53045924
{
"message": "Not Found",
"documentation_url": "http://developer.github.com/v3"
}
And also how can this be done using github_api or octokit in a ruby way (as i cant find documention about creating issue with it) currently what i did was using github_api gem
issues = Github::Issues.new user: 'user', repo: 'repo' it posts to the same url(https://api.github.com/repos/repo/user/issues) and again page not found error. and also i dont know how to sent authentication with it
Upvotes: 5
Views: 3055
Reputation:
I am guessing you are having issues because you are trying to use basic auth instead of oauth. Here is an example of how to use the github api gem to do that.
# Init the github api
github_api = Github.new basic_auth: 'login:password'
github_api.oauth.create scopes: ['repo']
# Creating a PR
github_api.pull_requests.create(user: 'username or org goes here', repo: 'repo name goes here',
title: 'example pr title', body: 'example pr body',
head: 'master', base: 'production')
# Creating an issue
github_api.issues.create(user: 'username or org name goes here', repo: 'repo name goes here',
title: "Found a bug",
body: "I'm having a problem with this.",
assignee: "octocat",
milestone: 1,
labels: [
"Label1",
"Label2"
]
)
Upvotes: 1