Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I retrieve a patch using the '' Accept header? #220

Open
thewoolleyman opened this issue Mar 5, 2015 · 1 comment
Open

How do I retrieve a patch using the '' Accept header? #220

thewoolleyman opened this issue Mar 5, 2015 · 1 comment

Comments

@thewoolleyman
Copy link

Hi,

Thanks for this api, very useful!

I'm trying to use it to get a patch, as is possible via the API with curl:

curl -H "Accept: application/vnd.github.v3.patch" -s https://api.github.com/repos/peter-murach/github/commits/ab788b9d4b5435c50c8e7e698f77265b1ff6170c

which outputs the patch:

From ab788b9d4b5435c50c8e7e698f77265b1ff6170c Mon Sep 17 00:00:00 2001
From: Piotr Murach <[email protected]>
Date: Sat, 7 Feb 2015 21:16:47 +0000
Subject: [PATCH] Document changes.

---
 CHANGELOG.md | 9 +++++++++
 1 file changed, 9 insertions(+)

...
...
etc...

Here's what I'm trying via the API, but I don't know how to actually retrieve the patch string like was output from curl using the API:

commits = Github::Client::GitData::Commits.new
commits.find('peter-murach', 'github', 'ab788b9d4b5435c50c8e7e698f77265b1ff6170c', accept: 'application/vnd.github.v3.patch')

FYI, my ultimate goal is to get the Patch ID, using this:

curl -H "Accept: application/vnd.github.v3.patch" -s https://api.github.com/repos/peter-murach/github/commits/ab788b9d4b5435c50c8e7e698f77265b1ff6170c | git patch-id --stable

6ce0f8722994af37467704b0d6542f981e250e32 ab788b9d4b5435c50c8e7e698f77265b1ff6170c

Thanks,
-- Chad

@thewoolleyman
Copy link
Author

Also, even with the example of request headers in the docs, I don't see how it is working. E.g., the two following examples seem to return identical results. What's "raw" about the first one's response?

issues = Github::Client::Issues.new
issues.get 'peter-murach', 'github', 108, accept: 'application/vnd.github.raw'
issues = Github::Client::Issues.new
issues.get 'peter-murach', 'github', 108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant