How can I retrieve a Gitlab Project tag list through the API? - api

I'm writing a REST client to look at project information available from several gitlab servers at the same time in one consolidated place. I understand REST and am able to pull the project details I need except one: the tags.
I'm not talking about git repository tags, those I'm able to get to just fine. I'm referring to the tags that are set under Project Settings. These are tags that, from what i can tell, are meant to be a form of describing the project, not referencing a particular commit hash.

I submitted a merge request back to the Gitlab folks, if accept, any REST call that involves a Project class will include a "tag_list" field with all the project labels.
The merge request is available here: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/329
EDIT: This was merged in Gitlab version 7.10.0 so now you can just run a GET on the Project and the tag_list will be included with the JSON response.

Try this:
http://www.example.com.br/api/v3/projects/#{str}/repository/tags?private_token=yourtoken"
Note that in #{str} variable, if you using a group/repository structure, you must replace the dash to %2F, for example, you must set:
http://www.example.com.br/api/v3/projects/group%2Frepository/repository/tags?private_token=yourtoken"
The response to your request will be the body. So you can console log response.body to retrieve the tags.

Not possible: ACCEPTING MERGE REQUEST at: http://feedback.gitlab.com/forums/176466-general/suggestions/6325819-project-labels-via-api , so feel free to implement it if you need it.
Should be simple: just return the project.tag_list (see: https://github.com/mbleigh/acts-as-taggable-on) as a JSON list from https://github.com/gitlabhq/gitlabhq/blob/41518a467dcef61deca24ad2f6205c6fd5706e1b/lib/api/projects.rb#L60
Always check the request tracker first for features ;) True, in this case you may have done it an not found because of label vs tag keyword confusion, I think it was renamed at some point, so always search for both.

Related

how to find a username with the github api

I've made an application that creates pull requests to update the dependencies in all of my org's repos when the repo "Alpha" gets a new tag. The process is triggered by our CI flow on Alpha. Other engineers here would like to upgrade this application so that whoever made the tag is also automatically added as a requested reviewer to all of the associated pull requests. I do not see any way to do this with the github REST api. So far I have:
GET tag by name -> tag object sha
GET tag (with obj sha) -> tagger name & tagger email
*************GAP**************
POST requested reviewer (with username) -> completed!
I can't see any good way to get a username from the REST api with the name and/or email. I could query commits from Alpha and filter them, BUT "person who tagged" != "person who made last commit AND I know that at least one of our more prolific taggers is sometimes logged in from different emails (web vs cli vs home machine, etc), so the app might miss them from time to time.
I think it may be possible to get what I want via the GraphQL api, but I'd really like to exhaust REST possibilities before I go down that road. Please shoot any ideas my way!
After gathering more information, it looks like it's possible, and even slightly more elegant than I anticipated. If I have the name of the tag (the 'ref'), I can get a specific commit with that rather than the SHA. the response for this commit includes author information that gives the login. I can then use this along with the pull number to request a reviewer.

Refference JSON schema from "define" API YAML file in Postman instead of creating a variable with actual JSON

I have an API in Postman that has defined JSON schemas for every request\response.
I also have a collection of tests that i use for testing this API.
But I don't know how to connect these two substances(things)
I have been searching for a solution for quite a while now and havent found an example set-up or a tutorial how? instead of creating a variable with actual schema in my test collection, I want to reuse already existing schema from API by $ref or some other link method.
This is my first question here, writing it just cause i haven't found a proper answer but functionality that i seek sounds really basic and logical.
Update from Valentin Despa:
"Please note that the API definition is written in a specification like Open API (or similar). It is not the same as the JSON schema which refers to the response body only."
So we can't validate response using that schema.

How to create a searchable central repository of code documentation using DocFx

I'm looking to create a central repository for all of our published API documentation using DocFx. I have documentation auto-generated via my build (using TFS) and published through my release (using Octopus) just fine for multiple individual sites. However, I'm wanting to pull it altogether in one location. The thinking is that through a parent site you could filter content in any of the individual sites without having to drill down into them. Do you have a recommendation on how to do this?
Also, within this same documentation repository I want to provide the capability to search by all of the meta data (project-level documentation) across the hundreds of projects in our portfolio. This will give our BA, DEV and QA teams easier access to what all our systems do. I like the "filtering" capability built into DocFx, but I'm wanting full-text search across all of the meta data. Do you have a recommendation for this functionality as well?
To change the location of the docfx output, edit the docfx.json file and specify the dest value. By default it is "dest": "_site". For more formatting guidance, reference: https://dotnet.github.io/docfx/tutorial/docfx.exe_user_manual.html.
Regarding full-text search, that is possible by simply ensuring the ExtractSearchIndex post-processor is invoked (in order to generate an index.json file of keywords) and that the global _enableSearch value is set to true in the docfx.json file. A snippet from that file would look like:
"postProcessors": [ "ExtractSearchIndex" ],
"globalMetadata": {
"_enableSearch": "true"
}
For your first question:
I think what you expect is like the .NET API Browser. The source code behind this page is not open to public, so you need create this page by yourself, through collecting xrefmap.yml from multiple sites, and extract the needed data into this page.
For your second question:
DocFX uses Luna to scan all the output files and generate an index file called index.json for later search use. In your case, you should want to limit the search scope only in the metadata you defined. This is also not supported by DocFX by default. You can also use Luna in your central place to search these meta. You can create your specific index.json for each project first, and the cental place to collect them for the search page.

Adding recipient Groups to a CiviCRM Mailing via REST.. how?

I have been able so far to create a new civi Mailing object and populate it, but confusingly I can't see a parameter in that to specify the mail destination group.
For context, I am dealing with Civi using pure REST api from a remote server. I have a solution to getting a custom template onto the server; the new problem is setting a schedule and delivery group, and initiating the send. I am using the python-civicrm library from github as the intermediary on the client.
I presume send happens as a result of setting the schedule -- i.e. I don't need an API call to say 'send mailing'? Is setting 'sheduled date' == 'now' safe or should I set a date of 'now + 1min' or similar?
So that leaves setting the delivery group. We already have groups defined in the DB, and I want to specify the group by name (and preferably be able to verify in advance that a group name is a valid destination, perhaps by doing a group name -> id lookup).
I think there might be a parameter to Mailing create 'groups' which can have keys 'include' and 'exclude'; at least, that's what the web form seems to do. However it's not mentioned in the REST api implementation.
Can anyone offer pointers?
I think you will find all you need in the following link :
Example of api call that is using the group include/exclude : https://gist.github.com/xurizaemon/6775471
Discussion about implementing mailing as an api - http://forum.civicrm.org/index.php?topic=24075.0
Otherwise, if it doesn't work, i suggest that you :
help adding this api in the CiviCRM Core - you could have some help on this on irc #civicrm (and have a look at https://issues.civicrm.org/jira/browse/CRM-11023)
OR create an extension with the api you need. It will be automatically available for REST. If you haven't created an extension yet, i suggest you go to the page http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension. It's quite straightforward with civix installed.
The table you need to check in the database is civicrm_mailing_group
To confirm, the problem was that (a) I needed to use groups[include]=array(ids) as mentioned by samuelsov, but also (b) I needed to use the json={...} form of request through REST, because the HTTP params syntax doesn't support nested data.

How does one list the changes via the API from a TeamCity build?

I'm trying to find a way to get all the comments from a particular build in TeamCity via the Rest API. How can one do that?
http://teamcity:port/httpAuth/app/rest/changes?locator=build:(id:77651)&fields=count,change:(version,username,date,href,comment,files)
Via this URL, one can list out in custom fashion exactly the fields they wish to return. I don't think this is documented, i got this from their support folks. Enjoy!
PS - There are other examples out there which iterate over each change, this lists out all the changes for a particular build id in one place, for parsing.