Get Github Enterprise Stats using API - github

i am trying to fetch statistics of GitHub instance using the below command as per https://developer.github.com/enterprise/2.15/v3/enterprise-admin/admin_stats/
curl -u username:password https://<hostname>/api/v3/enterprise/stats/:all
However i am getting the below message. Please help me in fixing this issue
{
"message": "Not Found",
"documentation_url": "https://developer.github.com/enterprise/2.14/v3"
}

Since the documentation states:
It is only available to authenticated site administrators.
Normal users will receive a 404 response if they try to access it.
Check first if you are declared as a site admin on your GitHub Enterprise server.

The issue got sorted by removing : (before all) in the api

Related

How do you delete a GitHub pull request requested review?

How do you delete a GitHub pull request requested review? This is about deleting the request for review on a pull request, not the pull request itself. I can't find a way using the website.
I also tried using the REST API:
curl -i -X DELETE -u cherryblossom000 https://api.github.com/repos/<repo owner>/<repo name>/pulls/<pull number>/requested_reviewers -d '{"reviewers":["reviewer name"]}'
but I get this error:
{
"message": "Validation Failed",
"errors": [
"Could not add requested reviewers to pull request."
],
"documentation_url": "https://developer.github.com/v3/pulls/review_requests/#delete-a-review-request"
}
The GraphQL API doesn't seem to have a mutation to delete a review request either.
I too had this problem and also got several "Validation failed" messages. So I figured it might be because I didn't have direct permissions on the repo.
After emailing Github developer support, they confirmed that you can delete (or dismiss) a review request, provided you have direct permissions on the repository.
In conclusion, your REST API approach is correct. You only get the "Validation failed" message if you do not have direct permissions on the repo.

Postman request showing IBM cloud down for maintenance

I am trying to send post request to create a toolchain on ibm cloud but getting this error mentioned in screenshot since last three days.
Why this error is coming up,am i doing something wrong?
Also i checked ibm none of the servers are down,cloud is normal
EDIT:So now i am able to create the toolchain,seems it was Authorization token error.
But now i am not Able to add a delivery pipeline through an api to an existing toolchain,is this functionality provided in IBM?
We are trying to understand your situation, but we have not been able to reproduce that Error 500 and "IBM Cloud console is down for maintenance" error you're seeing.
Could you try it again and let us know the datestamp&timezone of when you tried (so we can check our logs)?
Also can you give us the details of your default region, please?, as in if you open
https://cloud.ibm.com/devops/toolchains
does it redirect to:
https://cloud.ibm.com/devops/toolchains?env_id=ibm%3Ayp%3Aeu-de
or to some other non-(eu-de) region?
We did see this entry in the log files:
[2019-07-31T15:06:43.934] [ERROR] template-v2 - Failed to read template from repo https://github.com/open-toolchain/simple-toolchain, branch master, type null: Authorization header contains invalid or expired credentials.
but that occurs when using an invalid Authorization header token, and the response to the browser is not Error 500, but is Error 400 with:
"errorDetails\":\"Property 'access_token' either missing or empty \"
Also, when attempting to create the open-toolchain/simple-toolchain template, it doesn't work; it gives Error 400:
"description":"Failed Schema Validation at prod-region,prod-organization,prod-space,api-key for pipeline"
but creating a toolchain works ok using the repository:
https://github.com/open-toolchain/headless-toolchain
You can provision a toolchain with components such as a delivery pipeline using a GET request. The building blocks are described in the documentation for the IBM Cloud Continous Delivery service as part of creating a "Deploy" button.
There are some tutorials that use that deploy button to build more complex solutions, like the secure-file-storage, logistics-wizard-toolchain, or insurance-toolchain.
The GET request starts off a more complex flow because you need to log in, often provide values, etc. So I would recommend to try that request in a browser and not POSTMAN.
I am now able to create toolchain using POST request.
I was using wrong token for Authorization and got confused since no error message was shown instead "IBM cloud is under maintenance" popped up.

Couldn't connect to database using Cloud SQL proxy

When using the GCloud CLI to create the service accounts and keys I get the following error
2018/02/24 22:32:35 New connection for "moodle-proj-10:europe-west2:mysqlinst10"
2018/02/24 22:32:35 couldn't connect to "moodle-proj-10:europe-west2:mysqlinst10": ensure that the account has access to "moodle-proj-10:europe-west2:mysqlinst10" (and make sure there's no typo in that name). Error during createEphemeral for moodle-proj-10:europe-west2:mysqlinst10: googleapi: Error 403: The client is not authorized to make this request., notAuthorized
When I delete the service accounts and corresponding keys are re-create it using the console, the error changes to the error below
2018/02/24 23:21:25 couldn't connect to "moodle-proj-10:europe-west2:mysqlinst10": Post https://www.googleapis.com/sql/v1beta4/projects/moodle-proj-10/instances/mysqlinst10/createEphemeral?alt=json: oauth2: cannot fetch token: 400 Bad Request
Response: {
"error" : "invalid_grant",
"error_description" : "Invalid JWT Signature."
}
Has anyone experienced this?
I had this problem when I followed the command line instructions in this help article
Solution is to delete the original service account and create a new one in the console using this help article.

github api does not return my post-receive web hook

I have manually added a web hook to my repository, but when I query the repository using the API I get
{
"message": "Not Found"
}
what is wrong?
the url: https://api.github.com/repos/akonsu/kamyanov-art.com/hooks/
First, don't put the extra '/' at the end.
That will get you an message "Not Found" every time, authenticated or not.
Second, to add to Ivan's answer, you need to authenticate to access that information about a repo (public or private).
As mentioned in the "API Getting Started" page:
HTTP/1.1 404 Not Found
{
"message": "Not Found"
}
Oh noes! Where did it go?
If you’re a grizzled HTTP user, you might expect a 403 instead.
Since we don’t want to leak information about private repositories, the GitHub API returns a 404 in this case, as if to say “we can neither confirm nor deny the existence of this repository.”
That is why you see a "Not Found" here.
See issue 294
fwiw, I was scratching my head on this same issue trying to debug a hook, and the solution was to pass basic authentication on the request.
You are probably trying to access the API endpoint without authorising (in which case he API will return a 404 response and the JSON error you mentioned). Try passing your credentials with:
curl -v -u akonsu https://api.github.com/repos/akonsu/kamyanov-art.com/hooks

Status API is showing server error on apiexplorer

The status API throwing a error while retrieving sync status of
QuickBooks (for Windows) entities:
-Server Error.
-404 - File or directory not found.
-The resource you are looking for might have been removed, had its name changed, or is
temporarily unavailable.
you can check on:
http://apiexplorer.developer.intuit.com/V2QBD#api
Consumer Key : qyprdj6FkwCXWoq9Q8oRYlz33HXfN8
Consumer Secret : WHElfjFy5ip8C7UGFQdSRnl9hCeDq4fivvyxTnX6
Access Token : qyprdY6MP5IbtWk6vXji7p7rjc5YsiWpqRWJxht2kuyNO9Wv
Access Token Secret : u5qksOlffIN1UwEdo2OPqnkpe3xNFTFRHZMEIXNm
RealmId: 641280550
Also the SyncActivity API shows details for account's only.
I want to resolve WriteBack Errors.
How to resolve this and get the Sync Status and Sync Activity?
The API Explorer is doing a GET instead of a POST. We’ll fix it.
You should not see this error if you use Fiddler for the Status API.
API Explorer has been fixed, you should now be able to query SyncActivity and SyncStatus