Bitbucket search repo API - bitbucket

I've been trying to find an API to query repositories on BitBucket based on language they're written in. Few years ago I've been using
https://bitbucket.org/repo/all/relevance?language=X
But right now the link is dead.
There is a new API under
https://bitbucket.org/api/2.0/repositories
But theres no documentation on any query parameters.
Is there any way to browse public repos?

No, at this moment there is no way to browse repositories on Bitbucket without using the search function. There is a proposal to add such a feature, expressed in issue #2934, which you might want to vote/watch.
On the API side, you can browse all public repositories using the endpoint https://bitbucket.org/api/2.0/repositories/, but you can't search and/or filter results.

Not sure when the API changed, but you can now do this by using the following syntax
https://api.bitbucket.org/2.0/repositories/USER_NAME?q=language=%22LANGUAGE%22
%22 is the decoded version of "
For a bit more information on filtering the request, refer to:
https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering#supp-endpoints
You can click on this link for a working example:
https://api.bitbucket.org/2.0/repositories/craigiswayne?q=language=%22shell%22
Should only bring back my public repositories that are set with shell language

Related

Get latest delta token for a mail folder

Is there a way to get the latest delta token for a mail folder, using the Graph API?
I couldn't find documentation for this particular use case. I could find docs for the same thing, but for OneDrive. Using that as a template, I tried using https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messages/delta?$deltaToken=latest. Calling the previous endpoint does return #odata.deltaLink, but it's not the latest one.
The $deltatoken=latest pattern is only supported for directory resources (users, groups, service principal, applications...) as stated in the documentation. It is supported for drive items with token=latest. (not the different query string parameter name)
Unfortunately, this option is not given for the mail resource type. I was also seeking for the same to pull only new emails only.
We need to traverse through all pages to get the latest delta token. Microsoft's team should consider supporting this in the future.

how to get all users of a project in JIRA throught rest api

I'm trying to get all the users which are there in a project,
I went throught this API https://docs.atlassian.com/software/jira/docs/api/REST/7.9.2/#api/2/user-findAssignableUsers, but idk why I'm getting {"errorMessages":["Internal server error"],"errors":{}}.
I also followed this article https://community.atlassian.com/t5/Answers-Developer-Questions/List-of-users-in-project-REST-API/qaq-p/536820 but I'm getting 401 unauthorised, as I don't have admin rights, I can't use the plugin mentioned in the above article. I'm stuck :( . I'll be thankful if anyone can help me.
Thanks.
First of all as Mech suggested, you will need to have admin access to the project to get required details. REST API uses exactly the same permissions as that of the normal JIRA UI.
If you want to fetch all the users(including different project roles) who have access to the respective project, then you need a chain of Jira REST Api calls as below,
Using this api to fetch all the available roles for a project,
GET /rest/api/2/project/{projectIdOrKey}/role
You will get some response like,
{
"Administrators": "http://www.example.com/jira/rest/api/2/project/MKY/role/10002",
"Users": "http://www.example.com/jira/rest/api/2/project/MKY/role/10001",
"Developers": "http://www.example.com/jira/rest/api/2/project/MKY/role/10000"
}
Then for each of the project roles(fetched in the first step), call the below jira rest api to give the respective list of users by passing the role id and project key,
GET /rest/api/2/project/{projectIdOrKey}/role/{id}
This is how you can get all project memebers (users) :
https://{YourCompanyName}.atlassian.net/rest/api/3/user/assignable/search?project={JiraIdProject OR JiraProjectKey}

Bitbucket - Retrieve a pull-request's tasks by REST api

I am assuming this is not possible but hoping it is.
I am using https://developer.atlassian.com/bitbucket/api/2/reference/ and trying to retrieve all tasks for a particular pull-request, but I can't figure out how.
Is it possible on Bitbucket Cloud (bitbucket.org)?
This is not currently possible - as I type this, the API returns the count of open tasks for a given PR (task_count in https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D), but not the content of those tasks.
It is not documented but, it works by sending GET call to below endpoint
https://api.bitbucket.org/2.0/repositories/TEAM/REPO_SLUG/pullrequests/PR_ID/tasks

Is it possible to reverse `orderBy` in BitBucket Server API for git tags?

Playing with Bitbucket Server API, I found these docs regarding git tags:
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags?filterText&orderBy
orderBy: string: ordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated)
What I want is the reverse alphabetical order.
In some different part of API docs I found the following info
You can sort result sets using the ?sort= query parameter, available
on the same resources that support filtering:
By default the sort order is ascending. To reverse the order, prefix
the field name with a hyphen (e.g. ?sort=-updated_on).
but it seems this trick doesn't work for orderBy; when I try orderBy=-ALPHABETICAL, it's the same as orderBy=ALPHABETICAL.
Is it possible to revert the order somehow?
your first link is a documentation for Bitbucket server API v1.0.
I'm assuming that it should work as is if you are really making your request against this version of the API.
Moreover, bitbucket server refers to the self-hosted version of Bitbucket, and i don't know if the public Bitbucket shares the same API in v1.
However, the second link you present is part of Bitbucket API v2.0 documentation.
In the Querying -> Refs (Branches/Tags/Bookmarks) section of the page, you can see that you can use the 'name' field as filter or sort field, that contains the tag name while querying tags. The correct syntax is shown near the top of the page.
I'm assuming you want to query the public API v2.0.
So to resume:
Bitbucket Server API v1.0
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags?orderBy=-ALPHABETICAL
Bitbucket Public API v2.0
https://api.bitbucket.org/2.0/repositories/{username}/{repo_slug}/refs/tags?sort=-name

TFS WebAccess API - attaching file and details

I want to use the TFS WebAccess to open/manage work items.
I have found some documentation here on how to open work items using an URL:
http://msdn.microsoft.com/en-us/library/bb822136%28VS.90%29.aspx
http:// Server : Port /wi.aspx?pname= Project &wit= Type &[ Field1 ]= Value1 &[ Field2 ]= Value2
Is there some documented way to use POST to attach items and provide other details in one HTTP call?
There is no REST api (or other way) on web access to post changes to work items. It is a great idea though. Please use user voice to file your suggestion. This place is actively monitored by the TFS product group for future features.
After some digging-up, it seems that the only way to currently do it is to either use the SOAP webservices, which are rather limited - TFS 2010 WebServices
Or you can go with trying to reverse engineer the HTTP protocol by mimicking the requests sent from a TFS client, for the methods that are not exposed above.

Resources