Pioux
New Member
Hi, I'm currently trying to connect to our enterprise GitHub in order to create branches and do some branch merges on an automated way.
Until now, I have succeeded to get lots of things from GitHub (like repos, branches, etc...) using GET method. Communication is working fine and results are consistants.
But in order to create a reference (a branch), according to GitHub API v3 documentation, I have to perform a POST and provide a Json as the entity.
Here is an extract from GitHub API v3 documentation:
Git Refs
as you can see we have to perform a POST request and attach a very simple Json to it (only two fields).
And here a part of my code (credentials are set before in the code and are not involved in the current problem):
mc-request = "https://myserver.com/api/v3/repos/SAV0/TEST-REPO/git/refs".
ao-json-request:writeFile("p:\git-request.json").
IF al-credentials-ready
THEN ao-Request = RequestBuilderost(mc-request,ao-json-request):ContentType("application/json"):UsingBasicAuthentication(ao-credentials):AcceptJson():Request.
I paste here the content of ao-json-request (dumped by the 2nd line above, as debug):
{"ref":"refs\/heads\/GIT-API-TEST","sha":"76fd0013b3ff2f3320e2996c1507c93e564b1596"}
My code used to get a branch details is very close than the extract above and work perfectly, but uses the GET method.
When I execute that, I receive the "422 - Unprocessable entity" response from GitHub and the entity contain only an HTML page showing "What ?", no details on the error.
Any idea of what could cause this problem ?
Thx
Until now, I have succeeded to get lots of things from GitHub (like repos, branches, etc...) using GET method. Communication is working fine and results are consistants.
But in order to create a reference (a branch), according to GitHub API v3 documentation, I have to perform a POST and provide a Json as the entity.
Here is an extract from GitHub API v3 documentation:
Git Refs
as you can see we have to perform a POST request and attach a very simple Json to it (only two fields).
And here a part of my code (credentials are set before in the code and are not involved in the current problem):
mc-request = "https://myserver.com/api/v3/repos/SAV0/TEST-REPO/git/refs".
ao-json-request:writeFile("p:\git-request.json").
IF al-credentials-ready
THEN ao-Request = RequestBuilderost(mc-request,ao-json-request):ContentType("application/json"):UsingBasicAuthentication(ao-credentials):AcceptJson():Request.
I paste here the content of ao-json-request (dumped by the 2nd line above, as debug):
{"ref":"refs\/heads\/GIT-API-TEST","sha":"76fd0013b3ff2f3320e2996c1507c93e564b1596"}
My code used to get a branch details is very close than the extract above and work perfectly, but uses the GET method.
When I execute that, I receive the "422 - Unprocessable entity" response from GitHub and the entity contain only an HTML page showing "What ?", no details on the error.
Any idea of what could cause this problem ?
Thx