Github site admin curl not working for active users - github

curl -L -u DEV:$DEVTOKEN https://github.company-name.net/api/v3/stafftools/reports/active_users.csv
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/enterprise/3.6/rest"
}
I am trying to curl by following directions here
https://docs.github.com/en/github-ae#latest/admin/configuration/configuring-your-enterprise/site-admin-dashboard
Why am I getting not found message error?

The "Reports" instruction does not include api/v3:
The site admin dashboard offers a Reports section as an alternative, making it easy for you to download CSV reports with most of the information that you are likely to need for users, organizations, and repositories.
curl -L -u USERNAME:TOKEN http(s)://HOSTNAME/stafftools/reports/all_users.csv

Related

Is it possible to run a curl command with a splunk dbxquery?

I am developing a dashboard that connects to Splunk via REST API and displays data on various charts/graphs etc. In order to get the data I have to make a POST request via curl (node.js). Everything is working great. However when I try to make a Post request with a dbxquery, it fails and returns 'fatal dbxquery unknown command.' I was wondering if anyone had encountered this before.
curl -H 'Authorization: Basic auth token' -k https://devfg.com:8089/services/search/jobs -d search=" | dbxquery query=\"SELECT count(*) FROM db.table\" connection=\"connection\"" -d output_mode=json
Are the permissions for the dbxquery command set to be executable from any app? Check under app permissions to see if the command is globally exported.
Alternatively, you may need to escape the *, so \*.
Otherwise, you should be able to run the dbxquery via a curl command.

fly login doesn't use GITHUB account

Im able to login to concourse successfully using
fly -t login -c -n -b
when i run,
fly -t <target> teams -d
i see, users = local:admin
Im not able to see my github account.
Not sure what config is to be modified
just ensure the team names are correctly entered as they are case sensitive

Getting 400: Bitbucket API command to grant Access on Branch

I am trying to automate the process to provide the user access on Bitbucket branches on the cloud via bitbucket API using curl command. Please help me with the command as I have visit link. But no luck.
I have run the below command but getting 400. Please help where I am doing the wrong.
.\curl -i -u user:password -H "Content-Type: application/json" -X POST -d '{"type": "no-delet
es","matcher": {"id": "refs/heads/branchname","displayId": "branchname","type": {"id": "BRANCH","name": "Bra
nch"},"active": true},"users": ["user"],"groups": []}' 'https://api.bitbucket.org/rest/branch-permissions/2.0/pro
jects/projectkey/repos/reponame/restrictions'

How to create a github.com repository over HTTP API?

According to the general instruction to the github.com API and the explanation of the create command
curl -u "krichter722" https://api.github.com # works (returns JSON response)
curl -d '{"name":"test"}' https://api.github.com/user/repos/
should work and create a repository, but the second command fails with
{
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3"
}
I found Using `curl` to create a repo on GitHub.com with two-factor authentication which resolves an issue caused by missing parts in the request for two-factor authentication.
Other questions, like "Bad Credentials" when attempting to create a GitHub repo through the CLI using curl, indicate that the URL is correct (the creation fails due to bad credentials according to error message in this case).
You can do it as follows:-
curl -u "$username:$token" https://api.github.com/user/repos -d '{"name":"'$repo_name'"}'
You can find personal access token in Github Settings -> Application, replace username with your username and repo_name with repository name.
Note:- You might need to create personal access token if you haven't used it earlier.

How to search using GitHub API in private organizations

I have a private organization GitHub (enterprise) repository, e.g. github.mycompany.com.
I want to search strings in code using the GitHub API. How do I search in mycompany-specific GitHub repositories?
I tried the query below and received 404:
curl -i -H "Authorization: token <token>" https://github.mycompany.com/api/v3/search/code?q=class
It seems to be authenticating fine, since I tried curl -u <userName> and
If I give the wrong password, I get an authentication error.
If I give the right password, it goes through, but returns 404 for the search query.
Currently, the Search API is still in preview on GitHub Enterprise. As a result, you need to specify a special media type in the Accept header to get things working.
Give this a try:
curl -i -H "Accept: application/vnd.github.preview+json" -H "Authorization: token <token>" https://github.mycompany.com/api/v3/search/code?q=class