How to get comments from gitlab? - api

Is it possible to get comments from issues on Gitlab? as I read official docs https://docs.gitlab.com/ee/api/issues.html comments are not included there.

In order to get the comments posted at an issue we will use the Gitlab API https://docs.gitlab.com/ee/api/discussions.html#list-project-issue-discussion-items
GET /projects/:id/issues/:issue_iid/discussions
By providing the project :id and the :issue_iid , the issue_iid in this case would be 2
By providing the following one liner we can get the comments and their metadata for a specific project and issue
curl -s --header "PRIVATE-TOKEN: <access token>" https://gitlab.com/api/v4/projects/<project id>/issues/<issue_iid>/discussions | jq '.[].notes[0]'

Related

GitHub API Access denied trying to update a workflow via API

I created a public repository within my personal account, created a PAT w/ the workflow permissions checked, but am unable to disable the workflow via the API as I receive a message stating that I must have admin rights to the repository. I believe the PAT has the correct permissions so I’m unsure as to why this isn’t working.
Here is the command I am attempting to use (based on the documentation):
curl -s christronyxyocum:MY-PAT -X PUT -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/MY-USERNAME/MY-REPO/actions/workflows/workflow.yml/disable
I can retrieve information about the workflow without any issues so I believe that I have the correct URL and formatting, etc. I have even tried creating a new PAT with the same permissions and that one experiences the same error.
I have figured this out. Rather than using the username:token format like they show repeatedly in their documentation, you must use the -H "Authorization: bearer TOKEN" header with the curl command.

Autodesk Forge Authentication - "The client_id specified does not have access to the api product"

Trying to follow tutorials but cannot get past authentication. From OSX shell:
curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate' -X 'POST' -H 'Content-Type: application/x-www-form-urlencoded' -d 'client_id=MY_CLIENT_ID&client_secret=MY_SECRET&grant_type=client_credentials&scope=data:read'
I get back:
...
* Connection #0 to host developer.api.autodesk.com left intact
{ "developerMessage":"The client_id specified does not have access to the api product","userMessage":"","errorCode":"AUTH-001","more info":"http://developer.api.autodesk.com/documentation/v1/errors/AUTH-001"}
I have enabled all of the APIs in the app's configuration page.
I regenerated the secret key twice - same result.
If I had screwed up the client_id/secret key somehow, it looks like I would get an AUTH-003 error so I don't think that is the problem.
Documentation lists several possible errors but not AUTH-001.
Any ideas on how to debug this?
TIA
Only way to get past that was to delete that app and create a whole new one from scratch. The new ID/Secret works.

Login Github with Curl

I tried call this command
curl -l -u "my_user_name" https://my-enterprise-github.com
Then, I input my password manually.
But it returns this
<html><body>You are being redirected.</body></html>
Please explain what's wrong with my command.
Thank you.
cURL should not be used for access to GitHub's (or most web) UI without specific reasons. GitHub provides an API to allow accessing data as a well-defined structure.
You mentioned wanting to get-a-single-pull-request. This relies on a URL pattern following GET /repos/:owner/:repo/pulls/:number.
So if you had a GitHub account, facebook, and wanted to look up a specific pull request 15947 in react-native. The full URL would be
https://api.github.com/repos/facebook/react-native/pulls/15947
The cURL command would be
curl -u osowskit -X GET https://api.github.com/repos/facebook/react-native/pulls/15947
Note that:
You will likely want to start using a PAT or OAuth token instead of username/password
There are tools that make exploring the GitHub API easier. postman or octokit
To start with you may want the -L flag. From the cURL Frequently Asked Questions
3.8 How do I tell curl to follow HTTP redirects?
Curl does not follow so-called redirects by default. The Location: header that informs the client about this is only interpreted if you're using the -L/--location option. As in:
curl -L http://redirector.com
Not all redirects are HTTP ones, see 4.14
There's also a CLI now that can be helpful for many similar use-cases:
https://cli.github.com/
$ gh pr list
Showing 2 of 2 open pull requests in Roblox/service-comms-nomad
#16 chi1 Traefik 1.7 GLB jobs chi1-glb-prep
#6 Cgt/t2 cgt/t2

Confluence REST API Authorization Failure

I am trying to use the Confluence REST API to create a page. I am using the curl example off of the documentation found HERE. Every time I try to run a terminal command using this curl I get a response that says 'HTTP Status 401 - Basic Authentication Failure - Reason : AUTHENTICATION_DENIED'. I see that someone else had a similar issue regarding their C# code, but there was never a resolution given. Hopefully someone with experience will be able to tell me what I am doing wrong. My curl is listed below with the sensitive parts replaced in <> format.
curl -u <USER>:<PASSWORD> -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"new page","space":{"key":"<PAGEKEY>"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' https://<SERVER>/wiki/confluence/rest/api/content/ | python -mjson.tool
I was finally able to resolve this. Through a combination of the answer here How to create new page in Confluence using their REST API? and using a login that had the appropriate permissions.

Create conversation via link in CIrcuit

I'm looking for a way to use a link or something like that to give a Circuit users opportunity to start new coversation fast.
As example there is a link for Telegram:
t.me/{userId}
If user click on this, he will be redirected to conversation with {userId}.
Is there some features on Circuit for this?
Are you looking for something like this?
https://eu.yourcircuit.com/#/email/mymailaddress#circuit.com
Please be aware that this link will only work for others but not for yourself (so try with the mail-address of one of your colleagues).
Hope it helps!
As far as I know, there isn't. A direct conversation with another user can be created by POST /conversation/direct:
curl -X POST "https://circuitsandbox.net/rest/v2/conversations/direct" -H "accept: application/json" -H "content-type: application/x-www-form-urlencoded" -d "participant=user_email_or_user_id"
You can find more info about the Circuit REST API here:
https://circuit.github.io/rest.html