Unable to add tags to workspace via Asana API - api

I am using the following command to add tags via the Asana API.
curl -u '<api_key>' https://app.asana.com/api/1.0/tags -d "name=testing" -d "workspace=15601112094251"
I even get a successful JSON reply with the created tag object. However, I never actually see the tag inside Asana. I also do not see the tag when listing all tags for my workspace.
When I query for the tags specifically by ID, I do see it though.
Bug on Asana's side? Or am I doing something wrong?

See https://stackoverflow.com/a/24873988/254896 - because of the way the data model works, tags that aren't assigned to anything are hidden.

Related

How to create custom fields in JIRA, and fetch the fields' data to external program?

I want to create a custom text field in user stories of JIRA. Once the custom field is created, when someone inserts/updates the custom field, I want to fetch the data on custom field to an external program in any format (i.e. String, JSON, .doc, .xls, .csv etc.)
P.S. I'm not a JIRA Administrator.
Thanks in Advance.
This documentation from JIRA provides you simple steps on how to add a custom field on JIRA for your own project, but for this to happen - you have to be a JIRA Administrator. This can't be helped much, as this is a limitation from JIRA itself.
But having said that, if you get it sorted from a JIRA Administrator from your Organization - getting the details of the newly added custom field is not that difficult. JIRA REST APIs will come to rescue in that scenario.
You can simply fire the following REST GET API call to get the details that are intended to known by you!
curl -D- -u fred:fred -X GET -H "Content-Type: application/json" https://jira.fred.com/rest/api/2/issue/FRD-88651
The call will further provide you the necessary details! Hope this answers your query!

Getting file diff with Github API

net project for which I need to detect and parse changes made to a specific single text file in a repository between different pull requests.
I've been successfully able to access the pull requests and the commits using the Github API but I don't know how to retrieve the lines that changed in the last commit?
Is this possible using the API? What would be the best approach?
If not should I try to read the last two file versions and implement a differ algorithm locally?
Thanks!
A pull request contains a diff_url entry like
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff"
You can do this for any commit. For example, to get the diff of commit 7fd1a60b01f91b3 on octocat's Hello-World it's https://github.com/octocat/Hello-World/commit/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d.diff.
This also works for branches. Here's master on octocat's Hello-World. https://github.com/octocat/Hello-World/commit/master.diff.
The general form is:
https://github.com/<owner>/<repo>/commit/<commit>.diff
For private repositories:
curl -H "Accept: application/vnd.github.v3.diff" https://<personal access token>:x-oauth-basic#api.github.com/repos/<org>/<repo>/pulls/<pull request>
Also works with the normal cURL -u parameter.
See: https://docs.github.com/en/rest/reference/pulls#get-a-pull-request
The crux is in the requested media type. You can pass the Accept header with value
application/vnd.github.diff
see documentation. For full reference, a GET request with the above and Authorization header to https://api.github.com/repos/{orgName}/{repoName}/pulls/{prId} does the trick.

API to GET the confluence page content via page name?

I want to CURL an API to get the contents of a confluence page using the pagename. I have an API to get the page details via pageid.
curl -u <userid>:<password> -X GET confluence-url/confluence/rest/prototype/1/content/<pageid>
But i want an API to get the same via pagename. Is that possible?
Check out confluence rest api examples
Maybe you are looking for something like this:
curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/content?title=myPage%20Title&spaceKey=TST&expand=body.storage"
EDIT:
"title" is the name of the page
"spaceKey" is the key for your space. Confluence is organized in spaces. You can read more about spaces here
Expansions are documented here. expand specifies which elements should be expanded in the response. as stated in the documentation
If your GET returns a list of results and you don't choose to expand anything, the response is terse, displaying only a basic representation of the resource. It will, however, include a list of the expandable items for the resource.
So if you want the response to include the content of your page, then you need to expand "body.storage". If you want to expand multiple things you can seperate them with comma.

How can I retrieve a Gitlab Project tag list through the 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.

Query to find document ID through Box API (using cURL or python)

This should be a relatively easy question. I have documents in my Box account that I'd like to view on a webpage. To do so I need the document ID. Is there an easy way to find the document id? I'm using this documentation http://developers.box.com/docs/ and tried:
curl https://api.box.com/2.0/files \
-H "Authorization: Bearer ACCESS_TOKEN"
But I receive a couldn't resolve host error.
My document resides in a folder as well. Will I need to query something different to find the document id found inside a folder?
Here's the API call you're looking for. This will return you file IDs for every file in a specified folder:
http://developers.box.com/docs/#folders-retrieve-a-folders-items
You've got a few options for finding the folder ID. You can use the root folder, which has an ID of 0, so you can get the files and folders in there and continue inspecting your Box account based on those Ids. Or you can use the search API endpoint to search by keyword and return folder and file IDs.
http://developers.box.com/docs/#search-searching-a-users-account