rest/api/2/issue/<issue-id>/transitions returns empty array - jira

I've created an issue that follows this workflow:
When I call rest/api/2/issue/<issue-id>/transitions after creating an issue (which is in OPEN status now) it returns the following JSON:
{
"expand": "transitions",
"transitions": [
{
"id": "4",
"name": "Start Progress",
"to": {
"self": "URL",
"description": "This issue is being actively worked on at the moment by the assignee.",
"iconUrl": "URL",
"name": "In Progress",
"id": "3",
"statusCategory": {
"self": "URL",
"id": 4,
"key": "indeterminate",
"colorName": "yellow",
"name": "In Progress"
}
},
"fields": {}
}
]
}
When I make the same call after I change the issue status to "IN PROGRESS" I get back
{
"expand": "transitions",
"transitions": []
}
My questions are:
In the first response shown above, I expected the transitions to "CLOSED" and "RESOLVED" along with the one to "IN PROGRESS". But I only get back the one leading to "IN PROGRESS". Why?
I expected the second response to contain the transitions to "CLOSED", "RESOLVED" and "OPEN", but it returns an empty array. Why?
Please explain the responses from this API
What call should I make to get the next possible transitions?

This is probably a permission issue. The API only shows the transitions that are available to the current user, thus if you are not allowed to execute the CLOSE or RESOLVE transitions due to conditions in the project workflow, they will not appear in the JSON object.
See getTransitions from the JIRA REST API :
Get a list of the transitions possible for this issue by the current user, along with fields that are required and their types.
In order to get the transitions, you can either log in with an account that has the required permissions (check the corresponding workflow) or modify the conditions of the transition in this workflow.

Related

Using an API with Zapier but getting "The app returned ""rest_data" param is incorrect. JSON data expected"."

So i grab data from an Airtable and then have a custom PUT as the second action using Samba Lives API, specifically Sessions -> PUT Session https://documenter.getpostman.com/view/2014682/samba-live-rest-api/6YzutHM#c87c1db7-2b5c-9b2b-7d63-6b531793cfe2
This is the data in the custom PUT:
Method: PUT
URL: https://samba.live/api/2/ourusername/session
Data Pass-Through? No
Data:
input_type=json&rest_data={
"topic": "Crazy Topic",
"duration": 30,
"start_time": "2025-09-10 12:00:00",
"invited_participants":[
{
"email":"flast#company.com",
"first_name":"First",
"last_name":"Last",
"role":2,
"send_email_invitation":true
},
{
"email": "first.last#gmail.com",
"first_name": "First",
"last_name": "Last",
"role": 1,
"send_email_invitation": true
}
],
}
Unflatten- yes
Basic Auth- ourusername|ourpassword
Headers- none
But the test fails and says "App returned "rest_data" param is incorrect. JSON is expected."
I'm not really sure what to try and Zapier just said we don't help with that. Only thing i could think to try was to delete the input_type section, and that returned with an error saying "Topic is required." Same thing when i left most of it and just deleted the rest_data part.
Any ideas?
Fixed - apparently the comma after the ] threw everything off.

Slack API chat.postMessage URL Unfurling

I have a bot app that sends a message to the slack channel. I am using https://api.slack.com/methods/chat.postMessage/ to send messages to the slack channel.
My message sometimes has few links (GIF) which are being rendered in the channel as a plain link.
I want them to be unfurled so that it can display animated GIF on the channel itself.
I tried passing unfurl_links: true to the API parameter however it doesn't work.
Here is my JSON payload
{
"text": "Anniversary Alert :confetti_ball:",
"channel": "C01AGGP63ST",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Anniversary Alert :confetti_ball:\n\nLet's all take a moment to congratulate <#U024FCGPW> on their 10 year anniversary!\n\nWe wish you a very happy anniversary and many more great years ahead with us.\n\nhttps://media0.giphy.com/media/1yjpDZgvGkb6nTynq3/giphy.gif?cid=cbd9d2f95475c686b1a293a6cf43de5f3f640e4eb012f714&rid=giphy.gif"
}
}
],
unfurl_links: true
}
Can someone please help?
Used "attachments" property of the API payload and it unfurls the link
{
"text": "Anniversary Alert :confetti_ball:",
"channel": "C01AGGP63ST",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Anniversary Alert :confetti_ball:\n\nLet's all take a moment to congratulate <#U024FCGPW> on their 10 year anniversary!\n\nWe wish you a very happy anniversary and many more great years ahead with us.\n\nhttps://media0.giphy.com/media/1yjpDZgvGkb6nTynq3/giphy.gif?cid=cbd9d2f95475c686b1a293a6cf43de5f3f640e4eb012f714&rid=giphy.gif"
}
}
],
"attachments": [
{
"text": "",
"image_url": "https://media0.giphy.com/media/1yjpDZgvGkb6nTynq3/giphy.gif?cid=cbd9d2f95475c686b1a293a6cf43de5f3f640e4eb012f714&rid=giphy.gif"
}
]
}
The big gotcha here is that slack unfurl is only triggered when it's a user (bots do not trigger unfurls). Too bad - I'm running into the same issue - unfurl was going to be the way to go but I missed the fine print. I think I'm going to just go with a chat threaded reply (which is way less pretty).

Extracting specific values from a dictionary in iOS Shortcuts to display in a Choose from List menu?

I have a REST endpoint that returns a body that looks like this:
"posts": [
{
"message": "This is another message",
"created": "2019-12-27 21:33:54+10",
"items": [...],
"tags": [...],
"toot_id": "12345"
},
{
"message": "This is a message",
"created": "2019-12-26 20:42:15+10",
"items": [...],
"tags": [...],
"toot_id": "12344"
}
]
I want to extract just the message and toot_id fields and use a "Choose from List" action to display the message text, and upon selection pass the corresponding toot_id of the chosen message to the next action. Unfortunately I'm greatly struggling with how to do this... I know Javascript and TypeScript and can handle this sort of thing in those languages with no problems, but iOS's Shortcuts app is thwarting me. I've got as far as a "Repeat with each item" with the posts key as a result of hitting my REST endpoint, but I'm stuck as to how to continue from there, and I'm not clear on whether I should be setting the various actions inside the loop to "as Text" or "as Dictionary" either.
Thanks!
This is a screenshot of how I got it to work in a similar situation.
The key for me was the combination of "Get dictionary from Input" (use the variable), "Set Dictionary Value", and then "Set Variable". Trying to do "Set Dictionary Value" on the variable directly (in one step) never worked.

Button/Link inside UILabel to switch to another ViewController

I want to show some Facebook posts inside my iOS app. I get the whole post as a JSON-object from the Graph API. Works pretty fine.
So, if a user makes a new post and tags any page inside this post, the user-id (or page-id) is also included in that JSON object, giving me the offset and length inside the text, which should link to that page. (Sounds weird, so let me give you an example):
{
"id": "135416986571191_709831435796407",
"from": {
"category": "Musician/band",
"name": "DANNIC",
"id": "135416986571191"
},
"to": {
"data": [
{
"category": "Musician/band",
"name": "Tom & Jame",
"id": "423531801036780"
},
{
"category": "Record label",
"name": "Revealed Recordings",
"id": "104563552952573"
}
]
},
"message": "Wait For You (Tom & Jame Remix) is coming out in 2 days on Revealed Recordings!",
"message_tags": {
"14": [
{
"id": "423531801036780",
"name": "Tom & Jame",
"type": "page",
"offset": 14,
"length": 10
}
],
"59": [
{
"id": "104563552952573",
"name": "Revealed Recordings",
"type": "page",
"offset": 59,
"length": 19
}
]
},
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xfa1/v/t15.0-10/10876067_709831642463053_709831435796407_64260_924_b.jpg?oh=49c825ff152d98de125820093b5cff05&oe=5551397E&__gda__=1431085295_7c41923cf64cc0946a39e85b705ee691",
....
....
As you can see, there is the "message_tags", which contains two page-ids, the name and offset and length. I want to replace the text in the "message" with a UIButton or just a link to that page. How can I do that?
Here is a screenshot of that post how it looks inside the Facebook App:
As you can see, the "Tom & Jame" is clickable and the rest (except "Revealed Recordings") is normal text. If you tap on 'Tom & Jame' it will switch to another View Controller showing the page of them. That's exactly what I want inside my app.
I know I could use an NSAttributedText for my label, and use the NSLinkAttributedName to make the text clickable. But I don't want my app to switch to safari and open the facebook page, I want to stay inside my app and just switch to another UIViewController, showing the infos of that page etc.
Can I use my app's url scheme for that link, even though I stay inside my app? Or can I put a UIButton inside that label and handle the tap inside my view controller?
Whats the best solution for that? Any help is appreciated! :)
What I would do is put the text in a UITextView and use NSAttributedText. I would construct the URLs in a manner that I could parse later (just enough to get UITextView to render a link, but it doesn't have to be a real URL on facebook).
Then I would override shouldInteractWithURL which is sent to the delegate of UITextView. Here, I could re-parse the URL, retrieve the data, and load my subsequent view controller.
Take a look at the reference here: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/UITextViewDelegate/textView:shouldInteractWithURL:inRange:

Activiti - Get Process Instance Details" Java API

I am using Activiti 5.12. As provided, in its user guide, REST API to get he details of a process instance is :
GET /process-instance/{processInstanceId}
Its response is something like this :
{
"id": "2",
"processDefinitionId": "financialReport:1",
"businessKey": "55",
"startTime": "2010-10-13T14:54:26.750+02:00",
"startActivityId": "startFinancialAnalysis",
"startUserId": "kermit",
"completed": false,
"tasks": [
{
"taskId": "3",
"taskName": "Analyze report",
"owner": null,
"assignee": "Kermit",
"startTime": "2010-10-13T14:53:26.750+02:00",
"completed": false
}
],
"activities": [
{
"activityId": "4",
"activityName": "Get report",
"activityType": "ServiceTask",
"startTime": "2010-10-13T14:53:25.950+02:00",
"completed": true,
"duration": 200
}
],
"variables": [
{
"variableName": "reportName",
"variableValue": "classified.pdf"
}
],
"historyVariables": [
{
"variableName": "reportName",
"variableValue": "classified.pdf",
"variableType": "String",
"revision": 1,
"time": "2010-10-13T14:53:26.750+02:00"
}
]
}
A JAVA API for the same is also provided, which is :
ProcessEngines.getProcessEngine(configuredProcessEngineName).getHistoryService().createHistoricProcessInstanceQuery().processInstanceId("somevalue").singleResult()
This Java API does not work, as teh return type HistoricProcessInstance does not have the method to get the task list.
My objective is to get the current state of a process instance, i.e which task it's presently at.
The REST API lists all tasks that process instance has carried out and the last task of the list is the one it's currently executing, as its property completed is false.
I want to achieve the same from java code.
Can you please help me out. Any alternative way to get to my objective is also fine with me.
You can use another query of HistoricService API:
List<HistoricTaskIntance> taskList = getHistoryService()
.createHistoricTaskInstanceQuery()
.processInstanceId(processInstanceId)
.list()
The current task status can be defined by HistoricTaskInstance.getEndTime() that will return null for open tasks.
I have tried this way out.
SELECT NAME_ FROM act_hi_taskinst where PROC_INST_ID_= 1000 and END_TIME_ IS NULL;"
act_hi_taskinst contains history tasks for each and every instance.
If the process with instance id is completed then you wont get any result, so you can check that condition before moving forward.
I have run this piece of SQL Statement to get the required task name.
The answer given by #Mike also meets the objective. Even here also you have to check whether process is incomplete.

Resources