Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3663

Creating a fork with the GitHub V3 API (REST)

$
0
0

I'm trying to fork a repo using the GitHub V3 API via REST, however, I am having issues making a POST request as per the docs (https://developer.github.com/v3/repos/forks/#create-a-fork).

Basically, what I have so far:

  • A logged-in user with an OAuth Token
  • A POST request setup to the API (URL: https://api.github.com/repos/carmichaelalonso/infiniteflight/forks/) - I am testing this with hurl.it to begin with.
  • Headers in the request: one has the name Authorization with the value 'token ...', the other specifies Content-Type with the value application/json
  • A body with the following JSON: {"organization" : "shortlisthome"} (shortlisthome is the account I am trying to fork the repo to.

I am not intending to fork this to an organization, instead of a standard user account, which is where I am getting confused. When I run the request, I do not get any authentication errors or 404 errors (I previously had but I had been entering incorrect values by mistake, causing such errors).

When I run this request though, I get the following result (a 422 unprocessable request):

{"message": "Validation Failed","documentation_url": "---url-to-docs---","errors": [        {"resource": "Fork","code": "invalid","field": "organization"        }    ]}

I am unsure whether or not I am able to fork this to a standard user, or if it is an error with my request. Please let me know if I can provide any more info (first post here so a bit unfamiliar with the convention).


Viewing all articles
Browse latest Browse all 3663

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>