Since bitbucket is ending support for mercurial, I am working on a program to automate the move of the projects to sourceforge, which (still) supports mercurial.
Using some sample API 2.0 code to list the repositories on bitbucket, I found that the repo information, loaded from the paginated JSON result, contains links to other information (non-interesting links shortened to ....):
links:
avatar: ....
branches: ....
clone: ....
commits: ....
downloads: {href: https://api.bitbucket.org/2.0/repositories/user/slug/downloads}
forks: ....
hooks: ....
html: ....
issues: {href: https://api.bitbucket.org/2.0/repositories/user/slug/issues}
pullrequests: ....
self: ....
source: ....
tags: ....
watchers: ....
Using the links I can automate getting all of the downloads, and all issues.
The mercurial repository itself, can of course be pulled and pushed quite easily.
Each issue has links as well:
links:
attachments: {href: https://api.bitbucket.org/2.0/repositories/user/slug/issues/1/attachments}
comments: {href: https://api.bitbucket.org/2.0/repositories/user/slug/issues/1/comments}
html: ....
self: ....
vote: ....
watch: ....
I have no way to map a bitbucket user to a sourceforge user, but I can add the individual comments to sourceforge including info on their original poster in text form.
When you change the state of an issue, e.g. closing it, you get an additional comment on bitbucket (with optional text). Unfortunately such comments gathered from the API have no information on the state changes and none of the others links found, provide this information.
Do I need to scrape the individual issues on the bitbucket website to get the changed status information, that can be seen there?
Looking through the JSON that is provided by exporting issues from bitbucket, did see the following top level keys:
attachments:
comments:
components:
issues:
logs:
meta:
milestones:
versions:
and the logs section actually contains the status change information. Trying with a url of the form
https://api.bitbucket.org/2.0/repositories/user/slug/issues/1/logs
but that didn't work.
Although I could automate retrieving the export and logs from the JSON from the zip file exported, I finally stumbled upon this information in the documentation. So the URL to use is
https://api.bitbucket.org/2.0/repositories/user/slug/issues/1/changes
The first changes entry is the creation, so that is less interesting. The rest of the entries overlap with comments. Since the changes include the comment text (if any) you can overwrite the comments with the more complete changes information based on the creation date-time-stamp (which seems equal to the microsecond).
Related
I am creating a state machine for YouTrack using JavaScript, and am trying to send an email to everyone in a group. In the old Workflows, this was done like this:
{group:PHP Developers}.notifyAllUsers("Subject","message");
I can't find anything in the new JavaScript API to do this, where can I find the global (not issue or project) groups?
In JS API it will look as follows:
entities.UserGroup.findByName('PHP Developers')
.notifyAllUsers('Subject','message');
However, another (and way more reliable) way to get a particular user group is to add it to requirements and the reference inside the code:
ctx.phpdevs.notifyAllUsers('Subject','message');
...
requirements: {
...
phpDevs: {
type: entities.UserGroup,
name: 'PHP Developers'
}
}
You may find more details in official documentation: UserGroup and Finding Specific Entities.
I am working on migrating data from multiple app items into one. I was able to move all the data over but I need to move comments and files as well.
I know the API allows you to create comments from an App (which I am doing) but I want to be able to create the comment and pass the original information (message,creator,created_on).
The API documentation doesn't show what are all the "possible" attributes for creating a comment.
Thanks.
Rico.
All details on how to create new comment are here: https://developers.podio.com/doc/comments/add-comment-to-object-22340
{
"value": The comment to be made,
"external_id": The external id of the comment, if any,
"file_ids": Temporary files that have been uploaded and should be attached to this comment,
[
{file_id},
.... (more file ids)
],
"embed_id": [OPTIONAL] The id of an embedded link that has been created with the Add an mebed operation in the Embed area,
"embed_url": The url to be attached
}
Please note, you can't set some of comment's attributes (like: creator, created_on).
I would like to move from Redmine to GitHub by importing my repositories and issues.
In my commits I referenced issues by using issues numbers like #343.
Since issues number are cross project inside Redmine, I would like to change issue id in GitHub to match the same as in Redmine.
Is it possible?
Not easily. You create an issue by POSTing to /repos/:owner/:repo/issues. You can set title, body, assignee, milestone, and labels - that's it.
You might want to instead append the Redmine issue number to the GitHub title, like:
Button doesn't click [Redmine #1234]
You could also link to the old issue in the body of the issue.
See the create an issue API documentation for more details.
If that's not good enough, you should know that issue#s are auto-incrementing, so you could keep the number by POSTing them in the correct order, and POSTing and DELETEing throwaway issues for gaps in the sequence.
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.
Let's say I have a plugin Foo in osclass. In that plugin we register a hook for when an item is posted. According to the osclass hooks documentation the only hook that is run when an item is posted is posted_item.
But as far as I can tell from looking at the code this is run after the initial item data has already been validated and stored in the database. What if a validation of some plugin specific code fails and I would like to show the user an error message and present him with the form again to give him/her the chance to alter this information? Much like if you try to submit a new item but don't fill in one of the base information like description for instance.
I can't seem to find a way to do this. Only workaround I find to avoid the item being posted despite containing invalid plugin specific data, without editing the main osclass code, is to delete the posted item again in the posted_item hook callback function of my plugin. This feels extremely cumbersome and also requires every other plugin to check that the item still exists to make sure they don't save data connected to an item that is now deleted.
What I would like, and wonder if I have missed, is a hook that is run when an item is posted but before it's written to the database and have the ability to generate "errors" that would cause the item to not be posted and the user redirected back to the form with the "error" displayed just like for the basic item information.
Anyone have a solution I have missed? This feels like a very important part of plugins and without it posted items could become very fragmented.
A user on the osclass forums (teseo) told me about the undocumented hook pre_item_add that can be used.
<?php
function cust_my_plugin($aItem) {
osc_add_flash_error_message('My plugin has a complaint.');
$pItem = new CWebItem();
$pItem->redirectTo( osc_item_post_url() );
}
osc_add_hook('pre_item_add', 'cust_my_plugin');
?>
He also sais
The only bad news is that you can't merge your plugin validation
process with that of the core script, so if the ad had an error
related to your plugin and other errors, it would be rejected twice,
one by your plugin, the second by the core script. I couldn't see any
workaround for this little issue.