Flower REST API
About
The Flower REST API lets you start and read the processes that Flower runs in Jira from your own tools, for example to start a process instance when an order arrives in your shop system. The same endpoints exist on both hosts:
- Jira Cloud: served by the Flower server at
https://api.flower-bpm.com/flower/rest/api/1/{jiraInstance}. It keeps working for sites that moved from Connect to the Forge app (see Moving to Atlassian Forge). A site that installed the Forge app directly has no Flower REST API: there you use the Jira REST API, see Use Jira Directly. - Jira Data Center: inside your Jira at
{your Jira}/rest/flower/latest/api/1. The paths after the base URL are the same as on Cloud, without{jiraInstance}.
Flower for Data Center also has three endpoints for the processes that wait: POST /rest/flower/latest/service/processMessage sends a message to the process instance of a work item ({"issueKey", "name", "data"}, see Message Events), POST /rest/flower/latest/service/processSignal sends a signal to every waiting process instance ({"name", "data"}, see Signal Events), and POST /rest/flower/latest/service/automatedTask reports an automated task done.
The reference at the end of this page documents the REST resources, the HTTP response codes, and example requests and responses.
Quick Start
On Jira Cloud, all calls go to https://api.flower-bpm.com and use Basic auth with your Jira e-mail and an API token (see Authentication and Authorization). {jiraInstance} is the name of your Jira site: your-domain for your-domain.atlassian.net.
Start a process instance of the model BPMN-12:
# Replace the email, the API token, the Jira site, and the model key with your own values
curl --request POST \
--user '[email protected]:freds_api_token' \
--header 'Content-Type: application/json' \
--data '{"model": "BPMN-12", "summary": "Order 4711"}' \
'https://api.flower-bpm.com/flower/rest/api/1/your-domain/processInstance/'The response is the new process instance as JSON. model is the key of the model and is required, summary is optional. With "nodes": "all" in the body, Flower also creates the work items of all tasks at once; with a list of activity ids, for example "nodes": ["Activity_1", "Activity_2"], only those.
On Data Center, the same call goes to your Jira:
# Replace the token, the Jira URL, and the model key with your own values
curl --request POST \
--header 'Authorization: Bearer your_personal_access_token' \
--header 'Content-Type: application/json' \
--data '{"model": "BPMN-12", "summary": "Order 4711"}' \
'https://jira.example.com/rest/flower/latest/api/1/processInstance'The API allows 20 requests per 10 seconds per IP address. Above that, it answers with the status code 429; the RateLimit-* headers of the response tell you the limit and when the window resets. This limit is the one of the Flower server (Cloud). On Data Center, the limits of your Jira apply.
Endpoints at a Glance
Base URL: Cloud https://api.flower-bpm.com/flower/rest/api/1/{jiraInstance}, Data Center {your Jira}/rest/flower/latest/api/1.
| Method and path | What it does | Permission of the caller |
|---|---|---|
POST /processInstance | Starts a process instance of a model | Create issues in the space of the process instances |
GET /processInstance/{key} | Returns a process instance: the Jira work item with its Flower properties | Browse projects |
GET /processInstance/{key}/executionContext | Returns the execution context of a process instance | Browse projects |
POST /processInstance/{key}/activities | Creates the work items of the activities in the body {"nodes": ["Activity_1"]} (only tasks that have no work item yet). Without nodes, it creates the work items of all such tasks; "nodes": [] creates none. The engine does not run for this call: no conditions are evaluated | Edit issues on the process instance |
GET /model/{key} | Returns a model: the Jira work item with its Flower properties | Browse projects |
GET /model/{key}/bpmn/{version}/xml | Returns the BPMN of a model version as XML | Browse projects |
GET /model/{key}/bpmn/{version} | Returns the BPMN of a model version as JSON, with its nodes | Browse projects |
GET /model/{key}/dmn/xml | Returns the DMN of a model as XML | Browse projects |
GET /model/{key}/export | Returns the Flower archive of a model as a ZIP file | Browse projects |
GET /model/{key}/reportInstanceCountPerNode | Returns the numbers of the model report, see Monitor | Browse projects |
GET /startTypeMapping | Returns the start type mapping | Jira administrator |
POST /startTypeMapping | Adds an entry {"project", "type", "model"}; ?replace=true replaces the entry of the same space and work type | Jira administrator |
DELETE /startTypeMapping/{project}/{type} | Removes the entry of a space and work type | Jira administrator |
Cloud only: GET /flower/rest/api/1/endPoints lists all endpoints (no authentication), GET /flower/rest/api/1/spec returns them in the OpenAPI format.
For the format of a BPMN file, see Export and Import Your BPMN File.
Start Type Mapping
The start type mapping decides which model a new work item starts: a work item of a space and work type that is mapped to a published model becomes a process instance of that model (Flower Settings, tab Jira Work Type Mapping). The first entry that fits wins. These endpoints change single entries; the rest of the settings stays as it is. Only Jira administrators can use them.
An entry has three fields: project (the key of the Jira space), type (the id of the work type) and model (the key of a published model).
# Read the mapping (Data Center; on Cloud: https://api.flower-bpm.com/flower/rest/api/1/your-domain/startTypeMapping with Basic auth)
curl --header 'Authorization: Bearer your_personal_access_token' \
'https://jira.example.com/rest/flower/latest/api/1/startTypeMapping'
# Add an entry: new work items of the space ORD and the work type 10002 start the model BPMN-12
curl --request POST \
--header 'Authorization: Bearer your_personal_access_token' \
--header 'Content-Type: application/json' \
--data '{"project": "ORD", "type": "10002", "model": "BPMN-12"}' \
'https://jira.example.com/rest/flower/latest/api/1/startTypeMapping'
# Remove it
curl --request DELETE \
--header 'Authorization: Bearer your_personal_access_token' \
'https://jira.example.com/rest/flower/latest/api/1/startTypeMapping/ORD/10002'Flower checks an entry before it saves it: the space must exist, the work type must belong to it, and the model must be published. An entry for a space and work type that is mapped already is refused with 409; add ?replace=true to replace it. The id of a work type is in the Jira REST API (GET /rest/api/2/project/ORD lists the work types of a space with their ids).
Version and Status
| Version | 1 |
| Status | Beta and experimental. Resources can change, so test your integration after every Flower update. |
Authentication and Authorization
The Flower REST API is protected in the same way as the Jira REST API. You use the same credentials as for a Jira Basic auth connection, and access follows the permissions of the Jira user. See Basic auth for REST APIs for details.
A call with a wrong or expired e-mail and API token is answered with 401. The end points of a model and of a process instance answer for Flower models and process instances only: the key of any other work item gets 404.
Get an API Token (Jira Cloud)
Basic auth in Jira Cloud needs an API token instead of your password. This is more secure, because:
- You do not save your primary account password outside of where you sign in.
- You can revoke individual API tokens at any time.
- API tokens also work if your Atlassian organization has two-factor authentication or SAML enabled.
To create a token:
- Open Atlassian account API tokens and select Create API token.
- Enter a name that describes what the token is for, and choose an expiration date between 1 and 365 days.
- Copy the token and store it safely. You cannot display it again.
When a token expires, create a new one and update your integration. See Manage API tokens for your Atlassian account .
Test Your Credentials
The following call checks your credentials with a simple Jira request. It returns your own Jira user. Use the same credentials for the Flower resources in the reference below.
# Replace the email, the API token, and the domain with your own values
curl --request GET \
--user '[email protected]:freds_api_token' \
--header 'Accept: application/json' \
'https://your-domain.atlassian.net/rest/api/3/myself'Authentication on Data Center
On Data Center, the Flower REST API is part of your Jira: you log in as for the Jira REST API, with your username and password (Basic auth) or a personal access token as a bearer token. Flower checks the permissions of your Jira user before it runs a call (see the column “Permission” above): a work item you cannot see answers 404, one you can see but not edit 403. Without a login, Jira answers 401.
Read Flower Data with the Jira REST API
Models, process instances, and tasks are Jira work items. You can therefore also read them with Jira’s own search API and the Flower JQL fields, for example all open process instances:
# Searches all open process instances (Jira Cloud). Data Center uses /rest/api/2/search.
curl --request POST \
--user '[email protected]:freds_api_token' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{"jql": "flowerType = \"Process Instance\" AND resolution is EMPTY", "fields": ["summary", "status"], "maxResults": 50}' \
'https://your-domain.atlassian.net/rest/api/3/search/jql'In Jira Data Center, the Jira REST API takes your username and password (Basic auth) or a personal access token as a bearer token.
See Search Flower Data with JQL for all Flower search fields.
Changes with the Move to Forge
This section is about Jira Cloud. On Data Center, the Flower endpoints stay; nothing is switched off. Flower for Jira Cloud moved to Atlassian Forge (see Moving to Atlassian Forge and the Atlassian guide How to adopt Forge from Connect ). This changes how the Flower REST API calls Jira, and you can always use Jira directly instead.
Step 1: The Call Runs with the Permissions of the Caller
The Flower REST API passes your credentials on to Jira. Jira decides with the permissions of the API user, exactly like for a call of the Jira REST API, before and after your site moved to Forge. Flower does not use its own app permissions for these calls. Your credentials stay the same: Jira e-mail and API token.
This is what the API user needs in Jira:
| Call | Permissions of the API user |
|---|---|
POST /flower/rest/api/1/{jiraInstance}/processInstance | In the space of the process instances (Flower Settings, tab Jira Integration): Browse spaces, Create work items, Edit work items, and Add comments. In the space of the model: Browse spaces. If the process creates tasks of other spaces or work types, the user needs Create issues there too. |
GET /flower/rest/api/1/{jiraInstance}/model/{key}/bpmn/{version}/xml and the other read calls | Browse spaces in the space of the models. |
A missing permission makes the call fail with the status code Jira returns, usually 403, or 404 when the user cannot see the work item. Check that your API user can create and edit process instances in the Jira UI: if this works there, it works through the API.
Not sure which user your integration uses? It is the e-mail address of the API token. You can check it with the call Test Your Credentials.
Step 2: Or Use Jira Directly
Starting a process can also be done with the Jira REST API. Both ways work: the Flower endpoints stay. Jira directly needs no Flower server in between.
Start a process instance: Work Type Mapping and Create Issue
Instead of createProcessInstance, you create a Jira work item. Flower starts the process on its own when the work item is created in a space and with a work type that you mapped to a model.
- Open the Flower Settings, tab Jira Work Type Mapping, and map the Jira space and the work type to the published model. See Setup Flower.
- Create a work item of this space and work type with the Jira REST API:
# Creates a work item. Flower starts the mapped process for it. Replace the values with your own.
curl --request POST \
--user '[email protected]:freds_api_token' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{"fields": {"project": {"key": "ORD"}, "issuetype": {"name": "Order"}, "summary": "Order 4711"}}' \
'https://your-domain.atlassian.net/rest/api/3/issue'The work item is the process instance. You find its tasks as linked work items and can read everything with the Jira search API (see Read Flower Data with the Jira REST API).
Read the BPMN of a model: the Flower Endpoint
The BPMN of a model comes from the Flower REST API: GET /model/{key}/bpmn/{version}/xml returns the BPMN of a published version as XML. Publishing a model does not attach the BPMN file to the model work item.
# The BPMN of version 3 of the model BPMN-12. Replace the email, the API token, the Jira site, the model key and the version with your own values
curl --user '[email protected]:freds_api_token' \
'https://api.flower-bpm.com/flower/rest/api/1/your-domain/model/BPMN-12/bpmn/3/xml' --output BPMN-12.bpmnThe API user needs Browse spaces in the space of the models.
Reference
What’s Next?
- Search Flower Data with JQL: Find models, process instances, and tasks.
- Sync Magic: Call external services from a process with throw events.
- Setup Flower: Configure space and work types.