© 2018 SAP, Inc. All Rights Reserved. Workflow RESTful API Documentation
© 2018 SAP, Inc. All Rights Reserved.
Workflow RESTful API
Documentation
1 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Contents
Contents ........................................................................................................................................... 1
Introduction ..................................................................................................................................... 4
Authentication ................................................................................................................................. 5
Entity Beans ..................................................................................................................................... 7
Complete and Simple Bean .......................................................................................................... 7
Setting Entity’s child beans .......................................................................................................... 9
Searching entities ....................................................................................................................... 10
Limiting attributes returned in search ....................................................................................... 11
Returning errors with messages ................................................................................................ 12
Date and Date Time Bean attributes .......................................................................................... 13
Number and Decimal Bean attributes ........................................................................................ 13
Reading Custom Field values ...................................................................................................... 14
Setting Custom Field values ....................................................................................................... 17
Custom Field formats ............................................................................................................. 18
Length options ....................................................................................................................... 24
Entity Beans listing ..................................................................................................................... 27
HTTP response codes ..................................................................................................................... 37
APIs Listing ..................................................................................................................................... 38
Account ...................................................................................................................................... 39
Case ............................................................................................................................................ 40
Case Type ................................................................................................................................... 44
Company .................................................................................................................................... 45
Contact ....................................................................................................................................... 46
Custom Field............................................................................................................................... 47
Custom Table ............................................................................................................................. 48
2 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Department ................................................................................................................................ 49
Message ..................................................................................................................................... 50
Project ........................................................................................................................................ 51
User ............................................................................................................................................ 52
User Type ................................................................................................................................... 53
Detailed Workflow API ................................................................................................................... 54
Account ...................................................................................................................................... 54
Case ............................................................................................................................................ 67
Case Type ................................................................................................................................. 175
Company .................................................................................................................................. 179
Contact ..................................................................................................................................... 185
Custom Field ............................................................................................................................ 195
Custom Table ........................................................................................................................... 202
Department .............................................................................................................................. 224
Message ................................................................................................................................... 229
Project ...................................................................................................................................... 234
User .......................................................................................................................................... 244
User Type ................................................................................................................................. 254
Appendix A – Countries ................................................................................................................ 259
Appendix B – States ..................................................................................................................... 265
Appendix C – Custom Field Types ................................................................................................ 267
Appendix D – Error Codes ............................................................................................................ 268
Appendix E - Workflow API Overview .......................................................................................... 270
Account .................................................................................................................................... 270
Case .......................................................................................................................................... 270
Case Type ................................................................................................................................. 272
Company .................................................................................................................................. 272
Contact ..................................................................................................................................... 272
Custom Field............................................................................................................................. 272
Department .............................................................................................................................. 273
Message ................................................................................................................................... 273
3 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Project ...................................................................................................................................... 274
User .......................................................................................................................................... 274
User Type ................................................................................................................................. 274
4 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Introduction
The Workflow RESTful Service API (further referenced as Workflow API) is intended to allow third party applications to collaborate with Workflow. Workflow API enables its consumers to easily perform various operations over Workflow objects using standard HTTP methods: GET, POST, PUT and DELETE.
HTTP methods are used in this way:
1) GET – retrieve an entity 2) POST – create a new entity 3) PUT – update an entity 4) DELETE – delete an entity
For the call to be successfully completed user performing an API call must be authenticated.
Note: In order to easily try out the examples from this document you can use Google Chrome’s “Postman – Rest Client” extension, Mozila Firefox’s “RESTClient” add on or any other similar product. We recommend Google Chrome’s extension “Postman – Rest Client” which has a lot of options including call history, favourite calls, support for authorization, support for uploading files etc.
5 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Authentication
Each Workflow API request must be authenticated. Two request headers are required in reach request in order to authenticate the user performing an API call:
1) Authorization header Workflow API uses Basis Authentication mechanism with standard HTTP headers which means that no handshakes have to be done. User performing Workflow API call must be a Workflow user with admin rights. Username used for Workflow API authentication is user’s login name and password is user’s WS Token which can be found in Setup -> Users -> Users -> Edit specific user.
The Authorization header is constructed as follows: 1. Username and WS Token are combined together using semicolon into a
string "username:WsToken". 2. The resulting string is then encoded using Base64 encoding. 3. The authorization method and a space "Basic " is then put before the
encoded string.
Example: For user with login name “jsmith” and WSToken “0mr3ot99LYMvit77J9sf” Authorization header will look like this:
Authorization: Basic anNtaXRoOjBtcjNvdDk5TFlNdml0NzdKOXNm
Java code example for creating Authorization header looks like this:
C# code is very similar and would look like this:
String userName = "jsmith"; String wsToken = "0mr3ot99LYMvit77J9sf"; String nameToken = userName + ":" + wsToken; byte[] encodedBytes = Base64.encodeBase64(nameToken.getBytes()); String encoded = new String(encodedBytes); // anNtaXRoOjBtcjNvdDk5TFlNdml0NzdKOXNm String headerValue = "Basic " + encoded; String header = "Authorization: " + headerValue; System.out.println(header); // Authorization: Basic anNtaXRoOjBtcjNvdDk5TFlNdml0NzdKOXNm
byte [] bytesToEncode = Encoding.UTF8.GetBytes("jsmith:0mr3ot99LYMvit77J9sf"); String encodedText = Convert.ToBase64String(bytesToEncode); // anNtaXRoOjBtcjNvdDk5TFlNdml0NzdKOXNm …
6 Workflow API © 2018 SAP, Inc. All Rights Reserved.
2) domain header Domain header will tell Workflow to which domain does the API call refer to. On example, domain header might look like this:
domain: Workflow_api_test If user performing API call cannot be identified 403 Forbidden status will be returned.
7 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Entity Beans
Each Workflow entity (case, account, contact, user etc.) has it’s Bean representation which contains entity’s attributes. Beans are used to transfer data between requestor and Workflow. Here is what you need to know about Entity Beans before starting to use Workflow API.
Complete and Simple Bean
Each entity has it’s complete and simple bean representation. Complete entity Bean is returned when that same entity is requested and simple Bean representation is used when the entity exists as a child entity of some other entity Bean. On example, Contact Bean has “account” attribute and when Contact is returned it contains all information about contact and simplified account field representation.
Example of complete AccountBean
GET /accounts/account_b
Response body:
{ "billing_address": { "address2": "Fake Street 456", "address3": "Third Street 100", "city": "San Francisco", "country": {
"name": "USA", "system_id": "usa"
}, "state": {
"name": "California", "system_id": "CA"
}, "street": "Some Street 123", "zip": "12345"
}, "custom_fields": [ {
"name": "Day Went Live", "system_id": "day_went_live", "type_name": "Date", "type_system_id": 3, "value": "10/01/13", "value_formatted": "01/10/13"
} ], "description": "This is Account B.", "employees": "500",
8 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"fax": "555-555-777", "location": "San Francisco", "name": "Account B", "phone": "555-555-777", "shipping_address": { "address2": "Fake Street 456", "address3": "Third Street 100", "city": "San Francisco", "country": {
"name": "USA", "system_id": "usa"
}, "state": {
"name": "California", "system_id": "CA"
}, "street": "Some Street 123", "zip": "12345"
}, "system_id": "account_b", "uri": "http://localhost:8080/wpm/api/accounts/account_b", "web_site": "www.accountb.com"
}
We can see that the complete AccountBean contains more than 10 attributes.
Contact is requested via GET /contacts/jsmith_someaddress_com. Contact contains simple representation of AccountBean which only has three attribures (name, syste_id and uri).
GET /contacts/jsmith_someaddress_com
Response body:
{ "account": { "name": "Account B", "system_id": "account_b", "uri": "http://localhost:8080/wpm/api/accounts/account_b"
}, "active": true, "address": { "address2": "Second Street 456", "address3": "Third Street 789", "city": "San Francisco", "country": {
"name": "USA", "system_id": "usa"
}, "state": {
"name": "California", "system_id": "CA"
}, "street": "First Street 123", "zip": "12345"
}, "cell_phone": "555-555-456", "custom_fields": [ {
"name": "Contact Role", "system_id": "contact_role", "type_name": "Checkbox", "type_system_id": 8,
9 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"value": "Consultant", "value_formatted": "Consultant"
} ], "department": "", "email": "[email protected]", "fax": "555-555-741", "first_name": "John", "home_phone": "555-555-789", "id": 1894, "job_title": "Developer", "last_name": "Smith", "middle_name": "", "name": "John Smith", "phone": "555-555-123", "system_id": "jsmith_someaddress_com", "uri": "http://localhost:8080/wpm/api/contacts/jsmith_someaddress_com"
}
Setting Entity’s child beans
When an Entity is requested via GET method Workflow API returns complete entity with its child entities as simple beans. When a new Entity is created via POST method or updated via PUT method, entity’s child bean is set by sending child’s system id which is set as parents attribute. On example, contact has “account” attribute which is used do display data about account when certain contact is requested. On the other hand, when contact is created/updated we use contact’s attribute “account_system_id” to set the account to contact. The other example is CaseBean which uses “owner_system_id”, “contact_system_id”, “project_system_id” and other similar Bean attributes to set case owner, contact, project etc. Example for setting account while creating a new contact:
POST /contacts
Request body:
{
"account_system_id": "account_b", "active": true, "cell_phone": "555-555-111", "custom_fields": [ {
"systemId": "contact_role", "value": "consultant"
} ], "department": "", "email": "[email protected]", "first_name": "John", "home_phone": "555-555-987", "job_title": "Developer", "last_name": "Smith", "phone": "866.612.7312"
}
10 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Searching entities Most resources have methods for performing a search based on set criteria. Search criteria is set through query parameters. Response which is returned contains ResultBean which has list of objects and a few other attributes:
- total: number of entities that satisfy search criteria - page_size: number of entities which are going to returned in the search result.
Maximum number of entities returned in one search request can be up to 100. If “page_size” attribute is not set than “page_size” is set to default value of 10 entities.
- page: It represents page number which is going to be returned in the result bean. It is used for pagination in combination with page_size.
On example, if case search GET /cases?assignee=John&page=1&page_size=10 finds more than 50 cases, attritubes page=1 and page_size=10 will tell Workflow API to return first ten cases. If there is a need for next 10 cases, second page (page=2) would be requested and the request would look like this: GET /cases?assignee=John&page=2&page_size=10.
JSON example of department search:
GET /departments?name=accounting&page=1&page_size=5
{ "completed_in": 89, "departments": [ {
"company": { "name": "My Company Inc.", "system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/my_company_inc"
}, "gate_keeper": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith2", "system_id": "jsmith2", "uri": "http://localhost:8080/wpm/api/users/jsmith2", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "name": "Accounting", "system_id": "accounting", "uri": "http://localhost:8080/wpm/api/departments/accounting"
}, {
"company": { "name": "Other Company, Inc.", "system_id": "other_company_inc", "uri": "http://localhost:8080/wpm/api/companies/other_company_inc"
},
11 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"name": "Other Company Accounting", "system_id": "other_company_accounting", "uri": "http://localhost:8080/wpm/api/departments/other_company_accounting"
} ], "page": 1, "page_size": 5, "total": 2
}
Limiting attributes returned in search Search response contains a list of complete Bean objects. If there is a need to return a limited number of attributes then these attribute names are supposed to be send as query parameter with name “mask”. This parameter has the value of attribute names separated by space and it will tell Workflow API which attributes should it include inside the response.
An example case search which returns all case attributes would look like this:
GET /cases?assignee=jsmith tsmith&owner=tsmith&page=1&page_size=5
Response body would contain 5 cases that have jsmith and smith as assigness and in which tsmith is the owner. All these cases would have complete Bean representation (all case attributes would be returned). To return only case key, case name, assignees and status we form the request this way:
GET /cases?assignee=jsmith tsmith&owner=tsmith&mask=case_key name assignees status&page=1&page_size=5
Search result will contain CaseBeans with 4 required fields. Response body:
{ "cases": [ {
"assignees": [ { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }
], "case_key": "Task-sp-3", "name": "REST API - Case 3 - UPDATED", "status": { "name": "Described", "system_id": "described"
} }, {
"assignees": [ {
12 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }
], "case_key": "Task-sp-7", "name": "Case 2", "status": { "name": "Described", "system_id": "described"
} }
], "completed_in": 397, "page": 1, "page_size": 5, "total": 2
}
Returning errors with messages If a specific Workflow REST API call fails, besides HTTP Status code API returns ErrorBean with two attributes: “error_code” and “error_messages”. Atribute “error_code” tells which exception type occured and “error_messages” provide a list of messages which describe the error with the specific details. Error codes returned by Workflow REST API are listed in Appendix D.
This is an example of returned ErrorBean:
{ "error_code": "LENGTH_GREATER_THAN_MAXIMUM", "error_messages": [ "Invalid custom Field Participate In Event value '[event_1, event_2, event_3]'. Must be less than or
equal to 2." ]
}
13 Workflow API © 2018 SAP, Inc. All Rights Reserved.
This example contains multiple error messages inside “error_messages” list:
Date and Date Time Bean attributes Bean attributes which have Date and Date Time type, display their value based on the date/time settings for the user who is preforming a Workflow REST API call. These settings for each user are located on Workflow’s user side under Tools -> Settings -> Time and date Settings.
For example:
CaseBean has “created_on” attribute. User performing REST API call has the following settings:
- Time Zone: “Europe/Prague” - Date Display Format: “31.03.08” - “Time Display Format”: “23:02:12”
When some case is requested via GET /cases/Task-sp-2, “created on” attribute has the following value:
Number and Decimal Bean attributes
Returned format of Number and Decimal Bean attributes vary on user’s “number format” settings. User format can be changed on Workflow’s user page under Tools -> Settings -> Information -> Number Format. AccountBean has “employees” attribute with Number type (Integer) which is used for setting the number of account’s employees. Attribute “employees” is always set in this format “12345”. For displaying the value in user’s number format attribute “employees_formatted” is used. AccountBean has “annual_revenue” attribute with BigDecimal type which is used for setting the value of account’s revenue. Attribute “annual_revenue” is always set in this format “1234.56”. For displaying the value in user’s number format attribute “annual_revenue_formatted” is used.
{ "error_code": "CONSTRAINT_VIOLATIONS", "error_messages": [ "CustomField label is required.", "CustomField field type is required.", "CustomField system id is required.", "CustomField name is required."
] }
"created_on": "09.10.13 14:36:44"
14 Workflow API © 2018 SAP, Inc. All Rights Reserved.
For example, if user has “1,234.5” number format, fields will look like in the example below: GET /accounts/some_company_account Response body:
Reading Custom Field values This section explains the format of Custom Field values which Workflow API returns inside the response. The following entities have custom fields: case, user, project, account and contact.
CustomFieldBean has two attributes which are used to show the value of custom field:
- value – shows the value in default system format.
- value_formatted – shows the value based on user’s setting.
Value and value_formatted vary based on Custom Field type:
a) Date and Date time custom fields: Custom Fields which have Date or Date Time type, depend on user’s date/time settings. These settings can be changed on Workflow’s user page under Tools -> Settings -> Time and Date Settings. CustomFieldBean attributes look like this:
- value - shows the value in default system format - MM/dd/yyyy HH:mm:ss (24h notation)
- value_formatted - shows the value based on user’s date/time settings.
For example, user John Smith uses next date/time settings:
- Time Zone: “Europe/Prague” - Date Display Format: “31.03.08” - “Time Display Format”: “23:02:12”
{ "annual_revenue": 54321.35, "annual_revenue_formatted": 54,321.35, ... "employees": 10523, "employees_formatted": 10,523, ...
}
15 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request GET /cases/Task-sp-2/custom_fields/when_the_issue_resolved returns:
b) Number, Currency and Decimal custom fields:
These custom fields depend on user’s number format. User format can be changed on Workflow’s user page under Tools -> Settings -> Information -> Number Format. CustomFieldBean attributes look like this:
- value - shows the value in US format.
- value_formatted - shows the value based on user’s number format settings.
For example, user John Smith uses “1.234,56” number format settings.
Request GET /cases/Task-sp-2/custom_fields/price returns:
c) Custom Fields with predefined values (checkbox, radio button, pick list…) The following Custom Field Types have Predefined Values option: Autocomplete, Checkbox, Multiple Autocomplete, Multiple Choice Pick Up List, Pick List and Radio Button.
- value - shows Predefined Value labels separaded by semicolon.
- value_formatted - shows Predefined Value labels separaded by semicolon (the same as value).
{ "name": "When the issue resolved", "system_id": "when_the_issue_resolved", "type_name": "Date and Time", "type_system_id": 16, "value": "10/08/2013 17:16:00", "value_formatted": "08.10.13 17:16:00"
}
{ "name": "Price", "system_id": "price", "type_name": "Currency", "type_system_id": 33, "value": "123456789.12", "value_formatted": "123.456.789,12"
}
16 Workflow API © 2018 SAP, Inc. All Rights Reserved.
For example, “Checkbox” custom field with name “Available colors” has six predefined vauels:
Label SystemID Blue bl Red rd Green grn Yellow ylw White wht Black blk
Case Task-sp-2 has blue, green and white colors selected.
Request GET /cases/Task-sp-2/custom_fields/available_colors returns:
d) Project Autocomplete, User Autocomplete and Department Autocomplete custom fields
CustomFieldBean’s attribute "autocomplete_value" is used for returning the value of selected item combined with item’s system_id in form: “system_id:value”. For example: "autocomplete_value": "sp:Sales Project".
Request GET /cases/Task-sp-2/custom_fields/project_auto returns:
{ "name": "Available colors", "system_id": "available_colors", "type_name": "Checkbox", "type_system_id": 8, "value": "Blue; Green; White", "value_formatted": "Blue; Green; White"
}
{ "autocomplete_value": "sp:Sales Project", "name": "project auto", "system_id": "project_auto", "type_name": "Project Autocomplete", "type_system_id": 13, "value": "Sales Project", "value_formatted": "Sales Project"
}
17 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Setting Custom Field values Custom Field value is set through CustomFieldBean. These Custom Field Types are supported for setting values by Workflow API:
Text Large Text Rich Text Editor Email URL
Number Decimal Number Currency Percent
Radio Button Pick List Autocomplete ----------------------- Checkbox Multiple Choice Pick Up List Multiple Autocomplete
Date Date and Time
Project Autocomplete Department Autocomplete User Autocomplete
Two CustomFieldBean’s attributes must be sent to Workflow API: “system_id” and “value”. Example request: POST /cases/Task-sp-2/custom_fields Request body:
{ "system_id": "business_phone", "value": "555-555-123"
}
18 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Custom Field formats
This table shows the formats of certain Custom Fields values by Field Type expected by Workflow API:
Custom Field Type Expected value format(s) Date 02/25/13
2013-02-25 Feb 25, 2013
Date and Time 04/28/13 14:45:16 04/28/2013 14:45:16
Number 123456789 Decimal 1234567.9578 Currency 10999.99 Percent 65.6 Email [email protected] Autocomplete
One (and only one) predefined value’s system id: green_color Radio Button
Pick List Checkbox One or more predefined value’s system ids
separated by comma (and a space - optional): option_1, option_2, option_3 or option_1,option_2,option_3
Multiple Autocomplete Multiple Choice Pick Up List
Project Autocomplete System id of one selected item: sales_project accounting jsmith
Department Autocomplete User Autocomplete
Example request for setting value of Date Custom Field
a) Sending invalid value: POST /cases/Task-sp-2/custom_fields Request body:
{ "system_id": "day_went_live", "value": "02.25.13"
}
19 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
b) Sending valid value:
POST /cases/Task-sp-2/custom_fields Request body:
Response body (CaseBean):
{ "error_code": "BAD_DATE_FORMAT", "error_messages": [ "Value '02.25.13' cannot be converted to Date. Expected date formats (02/25/13, 2013-02-25 or Feb 25,
2013)." ]
}
{ "system_id": "day_went_live", "value": "02/25/13"
}
{ ... "case_key": "Task-sp-2", ... "custom_fields": [ {
"name": "Day Went Live", "system_id": "day_went_live", "type_name": "Date", "type_system_id": 3, "value": "02/25/13", "value_formatted": "25.02.13"
}, ...
], ... "system_id": "Task-sp-2", "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
20 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Example request for setting value of Checkbox Custom Field
“Available colors” custom field has 6 predefined values:
Label SystemID Blue bl Red rd Green grn Yellow ylw White wht Black blk
a) Sending invalid value: POST /cases/Task-sp-2/custom_fields Request body:
Response body:
b) Sending valid value: POST /cases/Task-sp-2/custom_fields Request body:
{ "system_id": "available_colors", "value": "bl,grn,somenonexistingcolor"
}
{ "error_code": "CUSTOM_FIELD_VALUE_DOES_NOT_EXIST", "error_messages": [
"'bl,grn,somenonexistingcolor' is not valid value for Custom Field Available colors." ]
}
{ "system_id": "available_colors", "value": "bl, wht, ylw"
}
21 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body (CaseBean):
Example request for setting value of Radio Button Custom Field
“Product Group” custom field has 3 predefined values:
Label SystemID Group 1 group_1 Group 2 group_2 Group 3 group_3
a) Sending invalid value: POST /cases/Task-sp-2/custom_fields Request body:
Response body:
{ ... "case_key": "Task-sp-2", ... "custom_fields": [ {
"name": "Available colors", "system_id": "available_colors", "type_name": "Checkbox", "type_system_id": 8, "value": "Blue; White; Yellow", "value_formatted": "Blue; White; Yellow"
}, ...
], ... "system_id": "Task-sp-2", "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
{ "system_id": "product_group", "value": "group_1, group_2"
}
{ "error_code": "CUSTOM_FIELD_VALUE_NOT_VALID", "error_messages": [ "Multiple value 'group_1, group_2' cannot be set to Radio Button. Single system_id expected."
] }
22 Workflow API © 2018 SAP, Inc. All Rights Reserved.
b) Sending valid value:
POST /cases/Task-sp-2/custom_fields Request body:
Response body (CaseBean):
Example request for setting value of Project Autocomplete Custom Field
On example, Project Autocomplete has all projects available for selection. Selected projects system_id is sent along with the system_id of selected project.
a) Sending invalid value: POST /cases/Task-sp-2/custom_fields Request body:
{ "system_id": "product_group", "value": "group_2"
}
{ ... "case_key": "Task-sp-2", ... "custom_fields": [ {
"name": "Product Group", "system_id": "product_group", "type_name": "Radio Button", "type_system_id": 7, "value": "Group 2", "value_formatted": "Group 2"
}, ...
], ... "system_id": "Task-sp-2", "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
{ "system_id": "project_auto", "value": "some_non_existing_system_id"
}
23 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
b) Sending valid value:
POST /cases/Task-sp-2/custom_fields Request body:
Response body (CaseBean):
{ "error_code": "CUSTOM_FIELD_VALUE_DOES_NOT_EXIST", "error_messages": [ "'some_non_existing_system_id' is not valid value for Custom Field project auto."
] }
{ "system_id": "project_auto", "value": "sp"
}
{ ... "case_key": "Task-sp-2", ... "custom_fields": [ {
"autocomplete_value": "sp:Sales Project", "name": "project auto", "system_id": "project_auto", "type_name": "Project Autocomplete", "type_system_id": 13, "value": "Sales Project", "value_formatted": "Sales Project"
}, ...
], ... "system_id": "Task-sp-2", "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
24 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Length options
Custom Field values which are set through CustomFieldBean must meet specific requirements.
c) Minimum and maximum number of characters
- Custom Field Types: Number, Decimal Number, Percent, Text, Large Text, and URL have minimum and maximum allowed characters options. These options can be set under “Advanced Settings” on Custom Field’s “Advanced” tab (“Minimum” and “Maximum”). (For fields of Text, Large Text and URL Custom Field Type, “maximum option” is called “Length”.)
- Text Custom Field Type has default maximum of 256 characters. - Rich Text Editor Custom Field Type has maximum number of characters (“Length”
option) and does not have “minimum” option.
For example, we have a Custom Field “Business Phone” with type Text and we set “Length” to 15 and “Minimum” to 5. Let’s set this custom fields value for case “Task-sp-2”. Two request with less than 5 characters and more than 15 characters will look like this:
- Less than 5 characters: POST /cases/Task-sp-2/custom_fields Request body:
Response body:
- More than 15 characters: POST /cases/Task-sp-2/custom_fields
{ "system_id": "business_phone", "value": "555"
}
{ "error_code": "LENGTH_LESS_THAN_MINUMUM", "error_messages": [ "Invalid custom Field Business Phone value '555'. Must be greater than or equal to 5."
] }
25 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request body:
Response body:
d) Minimum and Maximum number of selected Predefined Values Custom Fields Types: Checkbox and Multiple Choice Pick Up List have “Minimum” and “Maximum” options for setting minimum and maximum number of items which can be selected. These options can be set under “Advanced Settings” on Custom Field’s “Advanced” tab. For example, we have a Custom Field “Participate In Event” with type Checkbox with three predefined values.
Label SystemID Event 1 event_1 Event 2 event_2 Event 3 event_3
Under “Advanced” tab, “Maximum” option has value of 2 and “Minimum” option has value of 1. This means that the user has to pick at least 1 event he wants to participate in but can pick no more than 2 events.
a) Choosing more than 2 events POST /cases/Task-sp-2/custom_fields Request body:
{ "system_id": "business_phone", "value": "Phone/fax: 555-123-1234"
}
{ "error_code": "LENGTH_GREATER_THAN_MAXIMUM", "error_messages": [ "Invalid custom Field Business Phone value 'Phone/fax: 555-123-1234'. Must be less than or equal to
15." ]
}
{ "system_id": "participate_in_event", "value": "event_1, event_2, event_3"
}
26 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
b) Not choosing any event: POST /cases/Task-sp-2/custom_fields
Request body:
Response body:
c) Choosing 2 events POST /cases/Task-sp-2/custom_fields Request body:
Response body (CaseBean):
{ "error_code": "LENGTH_GREATER_THAN_MAXIMUM", "error_messages": [ "Invalid custom Field Participate In Event value '[event_1, event_2, event_3]'. Must be less than or
equal to 2." ]
}
{ "system_id": "participate_in_event", "value": ""
}
{ "error_code": "LENGTH_LESS_THAN_MINUMUM", "error_messages": [ "Invalid custom Field Participate In Event value ''. Must be greater than or equal to 1."
] }
{ "system_id": "participate_in_event", "value": "event_2, event_3"
}
{ ... "case_key": "Task-sp-2", ... "custom_fields": [ {
"name": "Participate In Event", "system_id": "participate_in_event", "type_name": "Checkbox",
27 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"type_system_id": 8, "value": "Event 2; Event 3", "value_formatted": "Event 2; Event 3"
}, ...
], ... "system_id": "Task-sp-2", "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
Entity Beans listing This is the list of all available Entity Beans. “Required” column marks the fields which must be set when the entity is being created. “Present in Simple Bean” column marks fields which are returned in simple bean representation.
AccountBean
Fields Field Type Required Present in Simple Bean
name String + + system_id String + + uri URI + description String location String phone String web_site String fax String annual_revenue BigDecimal annual_revenue_formatted String employees Number employees_formatted String billing_address AddressBean shipping_address AddressBean custom_fields List<CustomFieldBean>
AddressBean
Fields Field Type Required Present in Simple Bean
street String + city String + country CountryBean + country_system_id String + state StateBean + state_system_id String + zip String +
28 Workflow API © 2018 SAP, Inc. All Rights Reserved.
address2 String + address3 String +
CountryBean
Fields Field Type Required Present in Simple Bean
name String + system_id String +
StateBean
Fields Field Type Required Present in Simple Bean
name String + system_id String +
CustomFieldBean
Fields Field Type Required Present in Simple Bean
name String + + type_name String + + type_system_id Number + system_id String + + label String + value String value_formatted String autocomplete_value * String predefined_values List<PredefinedValueBean> uri URI + * Used for User Autocomplete, Project Autocomplete and Department Autocomplete fields
PredefinedValueBean
Fields Field Type Required Present in Simple
Bean label String + + system_id String + + position Number + + preselected Boolean + disabled Boolean +
29 Workflow API © 2018 SAP, Inc. All Rights Reserved.
ContactBean
Fields Field Type Required Present in Simple Bean
first_name String + + middle_name String + last_name String + name String system_id String + + account AccountBean account_system_id String phone String email String + + job_title String address AddressBean address_system_id String department String fax String cell_phone String home_phone String active Boolean custom_fields List<CustomFieldBean> uri URI +
ProjectBean
Fields Field Type Required Present in Simple Bean
name String + + system_id * String + + description String + is_default Boolean + custom_fields List<CustomFieldBean> project_roles List<ProjectRoleBean> permissions List<PermissionBean> uri URI + * Attribute “system_id” is the same as project’s unique key (shortcut).
30 Workflow API © 2018 SAP, Inc. All Rights Reserved.
ProjectRoleBean
Fields Field Type Required Present in Simple Bean
name String + system_id String + + user_system_id String + +
PermissionBean
Fields Field Type Required Present in Simple Bean
name String + system_id String + + description String +
UserBean
Fields Field Type Required Present in Simple Bean
login_name String + + system_id (the same as login_name)
String +
password String + first_name String + middle_name String last_name String + email String + department DepartmentBean department_system_id String + user_type UserTypeBean + user_type_system_id String + administrator Boolean active Boolean business_callendar String federation_id String custom_fields List<CustomFieldBean> uri URI +
31 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DepartmentBean
Fields Field Type Required Present in Simple Bean
name String + + system_id String + gate_keeper UserBean + gate_keeper_system_id String + company CompanyBean company_system_id String uri URI +
UserTypeBean
Fields Field Type Required Present in Simple Bean
name String + + system_id String + uri URI +
CompanyBean
Fields Field Type Required Present in Simple Bean
name String + + system_id String + + company_code String address_1 String address_2 String city String state String country String zip String project ProjectBean project_system_id String business_calendar_system_id String uri URI +
32 Workflow API © 2018 SAP, Inc. All Rights Reserved.
CaseTypeBean
Fields Field Type Required Present in Simple Bean
name String + system_id String + unique_key String +
StatusBean
Fields Field Type Required Present in Simple Bean
name String + system_id String +
ActionBean
Fields Field Type Required Present in Simple Bean
name String + type String + start_status StatusBean + end_status StatusBean +
MessageBean
Fields Field Type Required Present in Simple Bean
subject String + from_address String + body String date String + system_id String + uri URI +
33 Workflow API © 2018 SAP, Inc. All Rights Reserved.
CustomTableBean
Fields Field Type Required Present in Simple Bean
name String + system_id String + columns List<String> rows List<CustomTableRowBean> import_report String uri URI +
CustomTableRowBean
Fields Field Type Required Present in Simple Bean
oid String + cells List<CustomTableCellBean> +
CustomTableCellBean
Fields Field Type Required Present in Simple Bean
name String + value String +
TotalBean
Fields Field Type Required Present in Simple Bean
total Number +
QueryBean
Fields Field Type Required Present in Simple Bean
query String + + file_name String
34 Workflow API © 2018 SAP, Inc. All Rights Reserved.
QueryResultBean
Fields Field Type Required Present in Simple Bean
page Number + page_size Number + total Number + completed_in long + custom_table CustomTableBean + affected_rows_count Number + oid Number +
CaseBean
Fields Field Type Required Present in Simple Bean
name String + case_key String + system_id String + description String closed Boolean created_on String updated_on String status_changed_on String closed_on String case_type CaseTypeBean case_type_system_id String status StatusBean status_system_id String priority PriorityBean priority_system_id String project ProjectBean project_system_id String account AccountBean account_system_id String contact ContactBean contact_system_id String creator UserBean creator_system_id String updater UserBean updater_system_id String owner UserBean owner_system_id String referral UserBean
35 Workflow API © 2018 SAP, Inc. All Rights Reserved.
referral_system_id String team_member UserBean team_member_system_id String assignees List<UserBean> custom_fields List<CustomFieldBean> related_to_cases List<CaseBean> related_from_cases List<CaseBean> uri URI +
AttachmentBean
Fields Field Type Required Present in Simple Bean
name String + download_link String + system_id String + internal Boolean + company CompanyBean + uploader UserBean +
CommentBean
Fields Field Type Required Present in Simple Bean
comment String + system_id String + parent_system_id String + author UserBean + author_system_id String + updater UserBean + updater_system_id String + internal Boolean + company CompanyBean + created_on String + updated_on String +
ActionParamsBean
Fields Field Type Required Present in Simple Bean
name String + description String + priority_system_id String + status_system_id String +
36 Workflow API © 2018 SAP, Inc. All Rights Reserved.
ResultBean
ErrorBean
Fields Field Type error_code String error_messages List<String>
case_type_system_id String + project_system_id String + account_system_id String + contact_system_id String + owner_system_id String + referral_system_id String + assignees List<UserBean> + custom_fields List<CustomFieldBean> + comment String + comment_is_internal Boolean +
Fields Field Type page Number page_size Number total Number completed_in long users List<UserBean> cases List<CaseBean> contacts List<ContactBean> accounts List<AccountBean> departments List<DepartmentBean> user_types List<UserTypeBean> case_types List<CaseTypeBean> permissions List<PermissionBean> custom_fields List<CustomFieldBean> projects List<ProjectBean> companies List<CompanyBean> priorities List<PriorityBean> messages List<MessageBean> custom_tables List<CustomTableBean> custom_table CustomTableBean
37 Workflow API © 2018 SAP, Inc. All Rights Reserved.
HTTP response codes
The table below shows the listing of some of the most common HTTP status codes returned by Workflow APIs. For detailed desctiptions of each API method and information about each response code, see Detailed Workflow API.
For the complete list of HTTP status codes visit http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
HTTP status code Description 200 OK Workflow API call successfully completed. 201 Created Entity is successfully created. 204 No content Workflow API call successfully completed.
No content is returned inside response body. 304 Not Modified Operation is not completed.
Entity is not modified. 400 Bad Request Operation is not completed.
Parameters sent to Workflow API are invalid or missing which caused API call to fail.
403 Forbidden Operation is not completed. User performing API call is not authorized. User is trying to perform an action for which he has no permission.
404 Not Found Requested URI does not match any existing Workflow API path. Entity is not found.
405 Method Not Allowed The HTTP method is not supported by Workflow API for the requester URI.
406 Not Acceptable Accept header sent to Workflow API is not supported (Requester wants the data to be returned in the form which is not supported by Workflow API).
415 Unsupported Media Type Request body and Content-Type header contains content type which is not supported (Requester is sending the content that Workflow API is not able to receive).
500 Internal Server Error Unpredicted system error occured during Workflow API call.
38 Workflow API © 2018 SAP, Inc. All Rights Reserved.
APIs Listing
Workflow RESTful API exposes 12 different entities to third party applications. Besides basic CRUD operations API contains various useful operations for entity manipulation. Tables below show the listing of all available methods. Detailed Workflow API will go into the details of all methods and show the examples.
Prefix “/api/” is added before each path. For example:
GET http://social.webcomserver.com/api/accounts .
The following tables contain all available API paths and short description. Each HTTP Method is a Hyperlink to the detailed description in Detailed Workflow API.
Note: Each entity has it’s own system_id field. This field represents a unique human readable id for each entity. System_id is visible inside Workflow web application. System_id is unique on entity level. For example, two departments cannot have two the same system_id values. However, department and permission group can have the same vales as system_id.
39 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Account
Resource: Account Main path: /accounts
HTTP METHOD
PATH DESCRIPTION
1. GET /accounts/{system_id} Returns the account with specified system id. 2. POST /accounts Creates an account based on received AccountBean. 3. PUT /accounts Updates the account based on received
AccountBean. 4. DELETE /accounts/{system_id} Deletes the account with specified system id. 5. GET /accounts Search accounts based on set query parameters.
Returns a list of accounts which satisfy search criteria.
Custom Fields 6. GET /accounts/{system_id}/custom_fields/{custom_field_system_id} Returns specified custom field with its value which is
set for specified account. 7. POST /accounts/{system_id}/custom_fields Sets custom field value to specified account based on
received CustomFieldBean. 8. PUT /accounts/{system_id}/custom_fields Updates custom field value in specified account
based on received CustomFieldBean. 9. DELETE /accounts/{system_id}/custom_fields/{custom_field_system_id} Deletes the value of specified custom field for
specified account.
40 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Case
Resource: Case Main path: /cases
HTTP METHOD
PATH DESCRIPTION
1. GET /cases/{system_id} Returns the case with specified system id. 2. POST /cases Creates a case based on received CaseBean. 3. POST /cases/user/{user_system_id} Creates a case based on received CaseBean. Case’s
creator is user with system id “user_system_id”. 4. PUT /cases Updates the case based on received CaseBean. 5. PUT /cases/user/{user_system_id} Updates the case based on received CaseBean.
Case’s updater is user with system id “user_system_id”.
6. DELETE /cases/{system_id} Deletes the case with specified system id. 7. DELETE /cases/{system_id}/delete_with_related Deletes the case with specified system id and deletes
it’s related cases (cases for which case with system id “system_id” is their parent).
8. GET /cases Search cases based on set query parameters. Returns a list of cases which satisfy search criteria.
9. PUT /cases/{system_id}/close Closes the case with specified system id. 10. PUT /cases/{system_id}/close_with_related Closes the case with specified system id and closes
it’s related cases (cases for which case with system id “system_id” is their parent).
Balk Cases 11. POST /cases/create_bulk Creates a list of cases based on received list of
CaseBean objects.
12. PUT /cases/update_bulk Update a list of cases based on received list of CaseBean objects.
Case Lists 13. GET /cases/list/{system_id} Returns cases which belong to the list with specified
system id.
41 Workflow API © 2018 SAP, Inc. All Rights Reserved.
14. GET /cases/smart_list/{system_id} Returns cases which belong to the smart list with specified system id.
System Case Lists
15. GET /cases/system_list/creator Returns a list of cases in which user performing the REST call is the creator.
16. GET /cases/system_list/creator/{user_system_id} Returns a list of cases in which user with specified system id is the creator.
17. GET /cases/system_list/assignee Returns a list of cases in which user performing the REST call is the assignee.
18. GET /cases/system_list/assignee/{user_system_id} Returns a list of cases in which user with specified system id is the assignee.
19. GET /cases/system_list/owner Returns a list of cases in which user performing the REST call is the owner.
20. GET /cases/system_list/owner/{user_system_id} Returns a list of cases in which user with specified system id is the owner.
21. GET /cases/system_list/referral Returns a list of cases in which user performing the REST call is the referral.
22. GET /cases/system_list/referral/{user_system_id} Returns a list of cases in which user with specified system id is the referral.
23. GET /cases/system_list/team_member Returns a list of cases in which user performing the REST call is the team member.
24. GET /cases/system_list/team_member/{user_system_id} Returns a list of cases in which user with specified system id is the team member.
25. GET /cases/system_list/follower Returns a list of cases in which user performing the REST call is the follower.
26. GET /cases/system_list/follower/{user_system_id} Returns a list of cases in which user with specified system id is the follower.
Related Cases 27. GET /cases/{system_id}/related_cases Returns a list of related cases for case with specified
system id. 28. GET /cases/{system_id}/related_cases/inverse Returns a list of all cases from which case with
specified system id is related.
42 Workflow API © 2018 SAP, Inc. All Rights Reserved.
29. PUT /cases/{system_id}/related_cases/{related_system_id} Creates a relation between two existing cases. To case with system id "system_id" it sets related case with system id "related_system_id".
30. DELETE /cases/{system_id}/related_cases/{related_system_id} Deletes the relation between case with system id "system_id" and its related case with system id "related_system_id".
Custom Fields 31. GET /cases/{system_id}/custom_fields/{custom_field_system_id} Returns specified custom field with its value which is
set for specified case. 32. POST /cases/{system_id}/custom_fields Sets custom field value in specified case based on
received CustomFieldBean. 33. PUT /cases/{system_id}/custom_fields Updates custom field value in specified case based
on received CustomFieldBean. 34. DELETE /cases/{system_id}/custom_fields/{custom_field_system_id} Deletes the value of specified custom field in
specified case. Attachments
35. GET /cases/{system_id}/attachments Returns a list of attachments from specified case which user who is performing a REST call has permission to see.
36. GET /cases/{system_id}/attachments/{attachment_system_id} Returns (downloads) attached file with specified attachment system id from case with specified system id.
37. POST /cases/{system_id}/attachments Uploads attachment to specified case. 38. DELETE /cases/{system_id}/attachments/{attachment_system_id} Deletes the attachment with specified attachment
system id from specified case. Comments
39. GET /cases/{system_id}/comments Returns a list of comments from specified case which user who is performing a REST call has permission to see.
40. GET /cases/{system_id}/comments/{comment_system_id} Returns a comment with specified comment system id from specified case.
43 Workflow API © 2018 SAP, Inc. All Rights Reserved.
41. POST /cases/{system_id}/comments 1. Creates a comment based on received CommentBean in case with specified system id.
2. Creates a reply to comment with system id “parent_system_id” if “parent_system_id” is
sent via CommentBean.
42. PUT /cases/{system_id}/comments/{comment_system_id} Updates a comment based on received CommentBean in case with specified system id.
43. DELETE /cases/{system_id}/comments/{comment_system_id} Deletes a comment with specified comment system id in case with specified system id.
Actions 44. GET /cases/{system_id}/actions Returns all actions which user who is performing a
REST call can execute in specified case. 45. GET /cases/{system_id}/actions/{user_system_id} Returns all actions which specified user can execute
in specified case. 46. PUT /cases/{system_id}/actions/{action_system_id} Executes specified action in specified case. (Attach
file action has its own method.) 47. PUT /cases/{system_id}/actions/{action_system_id}/{user_system_id} Executes specified action in specified case as
specified user. (Attach file action has its own method.)
48. POST /cases/{system_id}/actions/{action_system_id} Executes specified Attach File action in specified case.
49. POST /cases/{system_id}/actions/{action_system_id}/{user_system_id} Executes specified Attach File action in specified case as specified user.
44 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Case Type
Resource: Case Type Main path: /case_types
Methods:
HTTP METHOD
PATH DESCRIPTION
1. GET /case_types/{system_id} Returns the case type with specified system id. 2. GET /case_types Search case types based on set query parameters.
Returns a list of case types which satisfy search criteria.
3. GET /case_types/{system_id}/statuses Returns statuses associated with specified case type. 4. GET /case_types/{system_id}/statuses/{status_system_id}/actions Returns actions in specified status for specified case
type.
45 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Company
Resource: Company Main path: /companies
HTTP METHOD
PATH DESCRIPTION
1. GET /companies/{system_id} Returns the company with specified system id. 2. POST /companies Creates a company based on received CompanyBean. 3. PUT /companies Updates the company based on received
CompanyBean. 4. DELETE /companies/{system_id} Deletes the company with specified system id. 5. GET /companies Search companies based on set query parameters.
Returns a list of companies which satisfy search criteria.
46 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Contact
Resource: Contact Main path: /contact
HTTP METHOD
PATH DESCRIPTION
1. GET /contacts/{system_id} Returns the contact with specified system id. 2. POST /contacts Creates a contact based on received ContactBean. 3. PUT /contacts Updates the contact based on received ContactBean. 4. DELETE /contacts/{system_id} Deletes the contact with specified system id. 5. GET /contacts Search contacts based on set query parameters.
Returns a list of contacts which satisfy search criteria.
Custom Fields 6. GET /contacts/{system_id}/custom_fields/{custom_field_system_id} Returns specified custom field with its value which is
set for specified contact. 7. POST /contacts/{system_id}/custom_fields Sets custom field value to specified contact based on
received CustomFieldBean. 8. PUT /contacts/{system_id}/custom_fields Updates custom field value in specified contact
based on received CustomFieldBean. 9. DELETE /contacts/{system_id}/custom_fields/{custom_field_system_id} Deletes the value of specified custom field for
specified contact.
47 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Custom Field
Resource: Custom Field Main path: /custom_fields
HTTP METHOD
PATH DESCRIPTION
1. GET /custom_fields/{system_id} Returns the custom field with specified system id. 2. POST /custom_fields Creates a custom field based on received
CustomFieldBean. 3. PUT /custom_fields Updates the custom field based on received
CustomFieldBean. 4. DELETE /custom_fields/{system_id} Deletes the custom field with specified system id. 5. GET /custom_fields Search custom fields based on set query parameters.
Returns a list of custom fields which satisfy search criteria.
48 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Custom Table
Resource: Custom Table Main path: /custom_tables
HTTP METHOD
PATH DESCRIPTION
1. GET /custom_tables/{system_id} Returns the custom table with specified system id. 2. POST /custom_tables Creates a custom table based on received
CustomTableBean. 3. DELETE /custom_tables/{system_id} Deletes the custom table with specified system id. 4. GET /custom_tables Search custom tables based on set query parameters.
Returns a list of custom tables which satisfy search criteria.
5. POST /custom_tables/{system_id}/column/{column_name} Adds a column with specified name into specified custom table.
6. GET /custom_tables/{system_id}/rows Returns rows from specified custom table. 7. GET /custom_tables/{system_id}/rows/{oid} Returns row with specified oid (object id) from
specified custom table. 8. POST /custom_tables/{system_id}/rows Adds one row in specified custom table based on
received row in CustomTableBean. 9. PUT /custom_tables/{system_id}/rows Updates the row in specified custom table based on
received row in CustomTableBean. 10. DELETE /custom_tables/{system_id}/rows/{oid} Deletes the row with specified oid in specified
custom table. Executing queries
11. PUT /custom_tables/query/select Executes select query sent via QueryBean and returns rows from custom table.
12. POST /custom_tables/query/insert Inserts data into custom table based on sent query in QueryBean.
13. PUT /custom_tables/query/update Updates data in custom table based on sent query in QueryBean.
49 Workflow API © 2018 SAP, Inc. All Rights Reserved.
14. PUT /custom_tables/query/delete Deletes data in custom table based on sent query in QueryBean.
Import 15. POST /custom_tables/import/new_table Creates a new custom table with rows from uploaded
csv file. 16. POST /custom_tables/{system_id}/import/new_rows Updates rows in specified custom table from
uploaded csv file. Export
17. PUT /custom_tables/export/query_to_csv Exports rows from custom table to CSV file based on received SELECT query in QueryBean.
Department
Resource: Department Main path: /departments
HTTP METHOD
PATH DESCRIPTION
1. GET /departments/{system_id} Returns the department with specified system id. 2. POST /departments Creates a department based on received
DepartmentBean. 3. PUT /departments Updates the department based on received
DepartmentBean. 4. DELETE /departments/{system_id} Deletes the department with specified system id. 5. GET /departments Search departments based on set query parameters.
Returns a list of departments which satisfy search criteria.
50 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Message
Resource: Message Main path: /messages
HTTP METHOD
PATH DESCRIPTION
1. GET /messages/{system_id} Returns message with specified system id. 2. DELETE /messages/{system_id} Deletes the message with specified system id. 3. GET /messages/user/{system_id}/unread Search unread messages for specified user based on
set query parameters. Returns a list of unread messages which satisfy search criteria.
4. GET /messages/user/{system_id}/unread_and_mark_as_read Search unread messages for specified user based on set query parameters. Returns a list of unread messages which satisfy search criteria and marks returned messages as read.
5. GET /messages/user/{system_id}/total_unread Returns the number of unread messages for specified user.
51 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Project
Resource: Project Main path: /projects
HTTP METHOD
PATH DESCRIPTION
1. GET /projects/{system_id} Returns the project with specified system id. 2. POST /projects Creates a project based on received ProjectBean. 3. PUT /projects Updates the project based on received ProjectBean. 4. DELETE /projects/{system_id} Deletes the project with specified system id. 5. GET /projects Search projects based on set query parameters.
Returns a list of projects which satisfy search criteria. Custom Fields
6. GET /projects/{system_id}/custom_fields/{custom_field_system_id} Returns specified custom field with its value which is set for specified project.
7. POST /projects/{system_id}/custom_fields Sets custom field value to specified project based on received CustomFieldBean.
8. PUT /projects/{system_id}/custom_fields Updates custom field value in specified project based on received CustomFieldBean.
9. DELETE /projects/{system_id}/custom_fields/{custom_field_system_id} Deletes the value of specified custom field for specified project.
52 Workflow API © 2018 SAP, Inc. All Rights Reserved.
User
Resource: User Main path: /users
HTTP METHOD
PATH DESCRIPTION
1. GET /users/{system_id} Returns the user with specified system id. 2. POST /users Creates a user based on received UserBean. 3. PUT /users Updates the user based on received UserBean. 4. DELETE /users/{system_id} Deletes the user with specified system id. 5. GET /users Search users based on set query parameters. Returns
a list of users which satisfy search criteria. Bulk Users
6. POST /users/create_bulk Creates a list of users based on received list of CaseBean objects.
7. PUT /users/update_bulk Updates a list of users based on received list of CaseBean objects.
Custom Fields
8. GET /users/{system_id}/custom_fields/{custom_field_system_id} Returns specified custom field with its value which is set for specified user.
9. POST /users/{system_id}/custom_fields Sets custom field value to specified user based on received CustomFieldBean.
10. PUT /users/{system_id}/custom_fields Updates custom field value for specified user based on received CustomFieldBean.
11. DELETE /users/{system_id}/custom_fields/{custom_field_system_id} Deletes the value of specified custom field for specified user.
53 Workflow API © 2018 SAP, Inc. All Rights Reserved.
User Type
Resource: User Type Main path: /user_types
HTTP METHOD
PATH DESCRIPTION
1. GET /user_types/{system_id} Returns the user type with specified system id. 2. POST /user_types Creates a user type based on received UserTypeBean. 3. PUT /user_types Updates the user type based on received
UserTypeBean. 4. DELETE /user_types/{system_id} Deletes the user type with specified system id. 5. GET /user_types Search user types based on set query parameters.
Returns a list of user types which satisfy search criteria.
54 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Detailed Workflow API
This section shows the detailed listing of WokFlow APIs with examples for each API call.
For each request, return MIME type is determined based on “Accept” request header which is sent by user calling Workflow API. Workflow API returns the result inside request body in specified format and sets MIME type value into Content-Type response header. JSON format is currently supported and fully tested.
For list of countries with their System IDs, go to Appendix A, for list of states with their System IDs, go to Appendix B and for list of Custom Field Types with their System IDs, go to Appendix C.
Account
Resource: Account Main path: /accounts
GET /accounts/{system_id}
HTTP Method GET Path /accounts/{system_id} Description Returns the account with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Account found.
404 Not Found – Account not found. Body AccountBean - success.
ErrorBean - failure.
JSON example:
a) GET /accounts/some_company_account
55 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
{ "annual_revenue": 123456789.21, "annual_revenue_formatted": "123,456,789.21", "billing_address": { "address2": "Second Street 456", "address3": "Third Street 789", "city": "Phoenix", "country": {
"name": "USA", "system_id": "usa"
}, "state": {
"name": "Arizona", "system_id": "AZ"
}, "street": "First Street 123", "zip": "11123"
}, "custom_fields": [ {
"name": "Number of Employees", "system_id": "number_of_employees", "type_name": "Number", "type_system_id": 2, "value": "1000", "value_formatted": "1000"
}, {
"name": "Number of Users", "system_id": "number_of_users", "type_name": "Number", "type_system_id": 2, "value": "500", "value_formatted": "500"
} ], "description": "Company Some Company from USA - specializes in marketing.", "employees": 10523, "employees_formatted": "10,523", "fax": "555-555-456", "location": "Phoenix, Arizona, USA", "name": "Some Company Account", "phone": "555-555-789", "shipping_address": { "address2": "Second Street 456", "address3": "Third Street 789", "city": "Phoenix", "country": {
"name": "USA", "system_id": "usa"
}, "state": {
"name": "Arizona", "system_id": "AZ"
}, "street": "First Street 123", "zip": "11123"
}, "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account", "web_site": "www.somecompany.com"
}
56 Workflow API © 2018 SAP, Inc. All Rights Reserved.
b) GET /accounts/some_non_existing_account
POST /accounts
HTTP Method POST Path /accounts Description Creates an account based on received AccountBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body AccountBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Account successfully created.
400 Bad Request – Required fields are missing or other constraint error.
Body AccountBean - success. ErrorBean - failure.
JSON example:
a) POST /accounts
Request body:
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Account does not exist."
] }
{ "annual_revenue": 123456789.21, "billing_address": { "city": "Phoenix", "country_system_id": "usa", "state_system_id": "AZ", "street": "First Street 123", "zip": "11123"
}, "custom_fields": [ {
"name": "Number of Employees", "system_id": "number_of_employees", "type_name": "Number", "type_system_id": 2, "value": "1000", "value_formatted": "1000"
}, {
57 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"name": "Number of Users", "system_id": "number_of_users", "type_name": "Number", "type_system_id": 2, "value": "500", "value_formatted": "500"
} ], "description": "Company Some Company from USA - specializes in marketing.", "employees": 10523, "fax": "555-555-456", "location": "Phoenix, Arizona, USA", "name": "Some Company Account", "phone": "555-555-789", "shipping_address": { "city": "Phoenix", "country_system_id": "usa", "state_system_id": "AZ", "street": "a21", "zip": "11123", "address2": "Second Street 456"
}, "system_id": "some_company_account", "web_site": "www.webcominc.com"
}
b) If account name which is required is not sent:
PUT /accounts
HTTP Method PUT Path /accounts Description Updates the account based on received AccountBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body AccountBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Account successfully updated.
400 Bad Request – Required fields are missing or other constraint error. 404 Not Found – Account not found.
Body AccountBean - success. ErrorBean - failure.
{ "error_code": "CONSTRAINT_VIOLATIONS", "error_messages": [ "Account name is required."
] }
58 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Note: AccountBean’s “system_id” field must be set. JSON example: PUT /accounts
Request body:
{ "annual_revenue": 555456789.65, "billing_address": {
"city": "Phoenix", "country_system_id": "usa", "state_system_id": "AZ", "street": "First Street 123", "zip": "11123"
}, "custom_fields": [ {
"system_id": "number_of_employees", "value": "1100"
}, {
"system_id": "number_of_users", "value": "650"
} ], "description": "Company Some Company from USA - specializes in marketing. - UPDATED DESCRIPTION", "employees": 10540, "fax": "555-555-456", "location": "Phoenix, Arizona, USA", "name": "Some Company Account", "phone": "555-555-789", "shipping_address": {
"city": "Phoenix", "country_system_id": "usa", "state_system_id": "AZ", "street": "a21", "zip": "11123", "address2": "Second Street 457"
}, "system_id": "some_company_account", "web_site": "www.webcominc.com"
}
59 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DELETE /accounts/{system_id}
HTTP Method DELETE Path /accounts/{system_id} Description Deletes the account with specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Account successfully deleted.
304 Not Modified – If account could not be deleted. 404 Not Found – Account not found.
Body ErrorBean - failure.
Example request: DELETE /accounts/some_company_account
GET /accounts
HTTP Method GET Path /accounts Description Search accounts based on set query parameters. Returns a list of
accounts which satisfy search criteria.
Available search attributes: page (Number) page_size (Number) name (String) system_id (String) decription (String) fax (String) location (String) website (String)
These search attributes are set as query parameters: /accounts?name=electronics&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A
60 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with a list of AccountBeans.
JSON example:
There are three accounts: Account A (Location: San Francisco, Employees 100), Account B (Location: San Francisco, Employees 500) and Account C (Location: Milwaukee, Employees 350). If we search accounts from San Francisco with word “Account” in account name we should get two accounts. Number of returned results can be limited with “page_size” and “page” attributes. We form the following request:
GET /accounts?name=account&location=San Francisco&page=1&page_size=10
Response body:
{ "accounts": [ {
"annual_revenue": 54321.35, "annual_revenue_formatted": "54,321.35", "billing_address": { "address2": "Second Street 456", "address3": "Third Street 789", "city": "San Francisco", "country": { "name": "USA", "system_id": "usa"
}, "state": { "name": "California", "system_id": "CA"
}, "street": "First Street 123", "zip": "12345"
}, "custom_fields": [ { "name": "Day Went Live", "system_id": "day_went_live", "type_name": "Date", "type_system_id": 3, "value": "10/01/13", "value_formatted": "01/10/13"
} ], "description": "", "employees": 1100, "employees_formatted": "1,100", "fax": "555-555-001", "location": "San Francisco", "name": "Account A", "phone": "555-555-001", "shipping_address": { "address2": "Second Street 456", "address3": "Third Street 789", "city": "San Francisco",
61 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"country": { "name": "USA", "system_id": "usa"
}, "state": { "name": "California", "system_id": "CA"
}, "street": "First Street 123", "zip": "12345"
}, "system_id": "account_a", "uri": "http://localhost:8080/wpm/api/accounts/account_a", "web_site": "www.accounta.com"
}, {
"annual_revenue": 987654.35, "annual_revenue_formatted": "987,654.35", "billing_address": { "address2": "Fake Street 456", "address3": "Third Street 100", "city": "San Francisco", "country": { "name": "USA", "system_id": "usa"
}, "state": { "name": "California", "system_id": "CA"
}, "street": "Some Street 123", "zip": "12345"
}, "custom_fields": [
], "description": "This is Account B.", "employees": 1560, "employees_formatted": "1,560", "fax": "555-555-777", "location": "San Francisco", "name": "Account B", "phone": "555-555-777", "shipping_address": { "address2": "Fake Street 456", "address3": "Third Street 100", "city": "San Francisco", "country": { "name": "USA", "system_id": "usa"
}, "state": { "name": "California", "system_id": "CA"
}, "street": "Some Street 123", "zip": "12345"
}, "system_id": "account_b", "uri": "http://localhost:8080/wpm/api/accounts/account_b", "web_site": "www.accountb.com"
} ], "completed_in": 432, "page": 1, "page_size": 10, "total": 2
}
62 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /accounts/{system_id}/custom_fields/{custom_field_system_id}
HTTP Method GET Path /accounts/{system_id}/custom_fields/{custom_field_system_id} Description Returns specified custom field with its value which is set for specified
account. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Field found.
404 Not Found – Account or Custom Field not found. Body CustomFieldBean - success.
ErrorBean - failure.
JSON example:
GET /accounts/account_a/custom_fields/day_went_live
Response body:
{ "name": "Day Went Live", "system_id": "day_went_live", "type_name": "Date", "type_system_id": 3, "value": "10/01/13", "value_formatted": "01/10/13"
}
63 Workflow API © 2018 SAP, Inc. All Rights Reserved.
POST /accounts/{system_id}/custom_fields
HTTP Method POST Path /accounts/{system_id}/custom_fields Description Sets custom field value to specified account based on received
CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Custom Field value set successfully.
400 Bad Request – Custom Field value is not in the right format. 404 Not Found – Account or Custom Field not found
Body AccountBean - success. ErrorBean - failure.
JSON example:
POST /accounts/account_a/custom_fields
Request body:
Response body:
{ "system_id": "additional_notes", "value": "Account A is the leader in electronic industry."
}
{ "annual_revenue": 54321.35, "annual_revenue_formatted": 54,321.35, "billing_address": { "address2": "Second Street 456", "address3": "Third Street 789", "city": "San Francisco", "country": {
"name": "USA", "system_id": "usa"
}, "state": {
"name": "California", "system_id": "CA"
}, "street": "First Street 123", "zip": "12345"
}, "custom_fields": [
64 Workflow API © 2018 SAP, Inc. All Rights Reserved.
{ "name": "Day Went Live", "system_id": "day_went_live", "type_name": "Date", "type_system_id": 3, "value": "10/01/13", "value_formatted": "01/10/13"
}, {
"name": "Additional Notes", "system_id": "additional_notes", "type_name": "Large Text", "type_system_id": 5, "value": "Account A is the leader in electronic industry.", "value_formatted": "Account A is the leader in electronic industry."
} ], "description": "", "employees": 1100, "employees_formatted": 1,100, "fax": "555-555-001", "location": "San Francisco", "name": "Account A", "phone": "555-555-001", "shipping_address": { "address2": "Second Street 456", "address3": "Third Street 789", "city": "San Francisco", "country": {
"name": "USA", "system_id": "usa"
}, "state": {
"name": "California", "system_id": "CA"
}, "street": "First Street 123", "zip": "12345"
}, "system_id": "account_a", "uri": "http://localhost:8080/wpm/api/accounts/account_a", "web_site": "www.accounta.com"
}
PUT /accounts/{system_id}/custom_fields
HTTP Method PUT Path /accounts/{system_id}/custom_fields Description Updates custom field value in specified account based on received
CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 200 OK – Custom Field value set successfully.
400 Bad Request – Custom Field value is not in the right format.
65 Workflow API © 2018 SAP, Inc. All Rights Reserved.
404 Not Found – Account or Custom Field not found Body AccountBean - success.
ErrorBean - failure.
JSON example:
PUT /accounts/account_a/custom_fields
Request body:
Response body:
{ "system_id": "day_went_live", "value": "11/20/13"
}
{ "annual_revenue": 54321.35, "annual_revenue_formatted": 54,321.35, "billing_address": { "address2": "Second Street 456", "address3": "Third Street 789", "city": "San Francisco", "country": {
"name": "USA", "system_id": "usa"
}, "state": {
"name": "California", "system_id": "CA"
}, "street": "First Street 123", "zip": "12345"
}, "custom_fields": [ {
"name": "Day Went Live", "system_id": "day_went_live", "type_name": "Date", "type_system_id": 3, "value": "10/01/13", "value_formatted": "01/10/13"
}, {
"name": "Additional Notes", "system_id": "additional_notes", "type_name": "Large Text", "type_system_id": 5, "value": "Account A is the leader in electronic industry.", "value_formatted": "Account A is the leader in electronic industry."
} ], "description": "", "employees": 1100, "employees_formatted": 1,100, "fax": "555-555-001", "location": "San Francisco", "name": "Account A", "phone": "555-555-001",
66 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"shipping_address": { "address2": "Second Street 456", "address3": "Third Street 789", "city": "San Francisco", "country": {
"name": "USA", "system_id": "usa"
}, "state": {
"name": "California", "system_id": "CA"
}, "street": "First Street 123", "zip": "12345"
}, "system_id": "account_a", "uri": "http://localhost:8080/wpm/api/accounts/account_a", "web_site": "www.accounta.com"
}
DELETE /accounts/{system_id}/custom_fields/{custom_field_system_id}
HTTP Method DELETE Path /accounts/{system_id}/custom_fields/{custom_field_system_id} Description Deletes the value of specified custom field for specified account. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom field value successfully deleted.
404 Not Found – Account or Custom Field not found. Body ErrorBean - failure.
Example request: DELETE /accounts/account_a/custom_fields/day_went_live
67 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Case
Resource: Case Main path: /cases
GET /cases/{system_id}
HTTP Method GET Path /cases/{system_id} Description Returns the case with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case found.
404 Not Found – Case not found. Body CaseBean - success.
ErrorBean - failure.
JSON example:
a) GET /cases/Task-sp-3
Response body:
{ "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith",
68 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "created_on": "09/10/13 14:50:49", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "20", "value_formatted": "20"
}, {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 3", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-3", "updated_on": "09/10/13 14:50:49", "updater": { "first_name": "John", "last_name": "Smith",
69 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-3"
}
b) GET /cases/some_non_existing_case
POST /cases Note: The case will not be created if you don't populate all required fields. e.g If you have a form with custom fields: contact(required), case name(required) and Priority(not required), the case will not be created if you don't populate contact and case name, priority is optional. This is applied to all actions with the case not just for creating case action.
HTTP Method POST Path /cases Description Creates a case based on received CaseBean.
Case creator - user who is performing REST API call. Case updater - user who is performing REST API call.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CaseBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Case successfully created.
404 Not Found – Any child entity (account, contact, creator rtc.) with sent system_id not found.
Body CaseBean - success. ErrorBean - failure.
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Case does not exist."
] }
70 Workflow API © 2018 SAP, Inc. All Rights Reserved.
JSON example:
a) POST /cases
User performing REST call is jsmith.
Request body:
Response body:
{ "case_type_system_id": "Task", "description": "This case is created via REST API.", "name": "REST API - Case 3", "project_system_id": "sp", "owner_system_id": "jsmith", "assignees": [ {
"system_id": "jsmith" }, {
"system_id": "tsmith" }
], "custom_fields": [ {
"system_id": "duration", "value": "20"
}, {
"system_id": "effort_left", "value": "15"
} ], "related_to_cases": [ {
"system_id": "Task-sp-1" }, {
"system_id": "Task-sp-2" }
] }
71 Workflow API © 2018 SAP, Inc. All Rights Reserved.
{ "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-3",
71 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "created_on": "09/10/13 14:50:49", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "20", "value_formatted": "20"
}, {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 3", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-3", "updated_on": "09/10/13 14:50:49", "updater": { "first_name": "John", "last_name": "Smith",
72 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-3"
}
b) If owner with sent system_id does not exist:
POST /cases/user/{user_system_id}
HTTP Method POST Path /cases/user/{user_system_id} Description Creates a case based on received CaseBean. Case’s creator is user with
system id “user_system_id”.
Case creator - user with system id “user_system_id”. Case updater - user with system id “user_system_id”.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CaseBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Case successfully created.
404 Not Found – User or any child entity with sent system_id not found.
Body CaseBean - success. ErrorBean - failure.
JSON example:
POST /cases/user/tsmith
User performing REST call is jsmith.
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Owner does not exist."
] }
73 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request body:
Response body:
{ "case_type_system_id": "Task", "description": "This case is created via REST API.", "name": "REST API - Case 3", "project_system_id": "sp", "owner_system_id": "jsmith", "assignees": [ {
"system_id": "jsmith" }, {
"system_id": "tsmith" }
], "custom_fields": [ {
"system_id": "duration", "value": "20"
}, {
"system_id": "effort_left", "value": "15"
} ], "related_to_cases": [ {
"system_id": "Task-sp-1" }, {
"system_id": "Task-sp-2" }
] }
{ "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
74 Workflow API © 2018 SAP, Inc. All Rights Reserved.
], "case_key": "Task-sp-5", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "created_on": "09/10/13 15:55:32", "creator": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "20", "value_formatted": "20"
}, {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 4", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-5", "updated_on": "09/10/13 15:55:32", "updater": {
75 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-5"
}
PUT /cases
HTTP Method PUT Path /cases Description Updates the case based on received CaseBean.
Case updater - user who is performing REST API call.
Important note: Case Type and Project cannot be changed using this method. Corresponding case actions should be invoked using this method: PUT /cases/{system_id}/actions/{action_system_id}
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body CaseBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case successfully updated.
404 Not Found – Case or any child entity with sent system_id not found.
Body CaseBean - success. ErrorBean - failure.
JSON example:
If we want to update the case created in POST /cases request we would have the following request:
PUT /cases
User performing REST call is jsmith. This user created a case. Request body:
{ "system_id": "Task-sp-3", "case_type_system_id": "Bug",
"description": "This case is created via REST API.",
76 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"name": "REST API - Case 3 - UPDATED", "project_system_id": "sp", "owner_system_id": "tsmith", "assignees": [ {
"system_id": "jsmith" }
], "custom_fields": [ {
"system_id": "duration", "value": "20"
}, {
"system_id": "effort_left", "value": "5"
} ], "related_to_cases": [ {
"system_id": "Task-sp-1" }, {
"system_id": "Task-sp-2" }
] }
Response body:
{ "assignees": [ {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-3", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "created_on": "09/10/13 14:50:49", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ {
"name": "Duration",
77 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "20", "value_formatted": "20"
}, {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "5", "value_formatted": "5"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 3 - UPDATED", "owner": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-3", "updated_on": "09/10/13 16:54:34", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-3"
}
78 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /cases/user/{user_system_id}
HTTP Method PUT Path /cases/user/{user_system_id} Description Updates the case based on received CaseBean. Case’s updater is user
with system id “user_system_id”.
Case updater - user with system id “user_system_id”.
Important note: Case Type and Project cannot be changed using this method. Corresponding case actions should be invoked using this method: PUT /cases/{system_id}/actions/{action_system_id}/{user_system_id}
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body CaseBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case successfully updated.
404 Not Found – User, Case or any child entity with sent system_id not found.
Body CaseBean - success. ErrorBean - failure.
JSON example:
If we want to update the case created in POST /cases/user/tsmith request we would have the following request:
PUT /cases/user/jsmith
User performing REST call is tsmith. User tsmith created a case. Request body:
{ "system_id": "Task-sp-5", "case_type_system_id": "Bug", "description": "This case is created via REST API.", "name": "REST API - Case 3 - UPDATED", "project_system_id": "sp", "owner_system_id": "tsmith", "assignees": [ {
"system_id": "tsmith" }
79 Workflow API © 2018 SAP, Inc. All Rights Reserved.
], "custom_fields": [ {
"system_id": "duration", "value": "20"
}, {
"system_id": "effort_left", "value": "1"
} ], "related_to_cases": [ {
"system_id": "Task-sp-2" }
] }
Response body:
{ "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-5", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "created_on": "09/10/13 15:55:32", "creator": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "1", "value_formatted": "1"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2,
80 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"value": "20", "value_formatted": "20"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 3 - UPDATED", "owner": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-5", "updated_on": "09/10/13 17:07:04", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-5"
}
81 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DELETE /cases/{system_id}
HTTP Method DELETE Path /cases/{system_id} Description Deletes the case with specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case successfully deleted.
304 Not Modified – If case could not be deleted. 404 Not Found – Case not found.
Body ErrorBean - failure.
Example request: DELETE /cases/Task-sp-1
DELETE /cases/{system_id}/delete_with_related
HTTP Method DELETE Path /cases/{system_id}/delete_with_related Description Deletes the case with specified system id and deletes it’s related cases
(cases for which case with system id “system_id” is their parent). Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case successfully deleted.
304 Not Modified – If case could not be deleted. 404 Not Found – Case not found.
Body ErrorBean - failure.
Example request: DELETE /cases/Task-sp-1
82 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases
HTTP Method GET Path /cases Description Search cases based on set query parameters. Returns a list of cases
which satisfy search criteria.
Available search attributes: page (Number) page_size (Number) name (String) decription (String) case_key (String) created_by (String) 1
updated_by (String) 2
assignee (String) 3
owner (String) 4
referral (String) 5
team_member (String) 6
status (String) 7
project (String) 8
priority (String) 9
case_type (String) 10
system_id (String) mask (String) 11
1, 2, 3, 4, 5 and 6 – user system ids sepatated with space: /cases?updated_by=jsmith tsmith&assignee=jsmith tsmith&owner=jsmith&team_member=jsmith
7, 8, 9 and 10 – entity system ids separated by space:
/cases?project=sp impl dev&case_type=Task Bug
11 – list of fields separated by space which are going to be returned in case object: /cases?project=sp&mask=name case_key status
These search attributes are set as query parameters: /cases?name=implement&updated_by=john&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK
83 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Body ResultBean with a list of CaseBeans.
JSON example:
There are three cases:
1. name: Case 1 case_key: Task-sp-1 project: sp assignees: jsmith, tsmith owner: jsmith
2. name: Case 2 case_key: Task-sp-2 project: sp assignees: jsmith, tsmith owner: tsmith
3. name: Case 3 case_key: Bug-dev-1 project: dev assignees: tsmith owner: jsmith
a) Complete CaseBean
If we want to find cases which are assigned to jsmith and tsmith and which has tsmith as case owner we will get only Case 2 in the result. We would form the following request:
GET /cases?assignee=jsmith tsmith&owner=tsmith&page=1&page_size=5
Response body:
{ "cases": [ {
"assignees": [ { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-2", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "created_on": "10/10/13 11:11:31", "creator": { "first_name": "John",
84 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ { "name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "1", "value_formatted": "1"
}, ], "description": "", "name": "Case 2", "owner": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "High", "system_id": "Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-2", "updated_on": "10/10/13 11:11:55", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
} ], "completed_in": 580, "page": 1, "page_size": 5, "total": 1
}
85 Workflow API © 2018 SAP, Inc. All Rights Reserved.
b) Using mask to return only specified fields
GET /cases?assignee=jsmith tsmith&owner=tsmith&mask=name case_key project&page=1&page_size=5
Reponse body:
{ "cases": [ {
"case_key": "Task-sp-3", "name": "REST API - Case 3 - UPDATED", "project": {
"description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
} }, {
"case_key": "Task-sp-5", "name": "REST API - Case 3 - UPDATED", "project": {
"description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
} }, {
"case_key": "Task-sp-7", "name": "Case 2", "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
} }
], "completed_in": 395, "page": 1, "page_size": 5, "total": 3
}
86 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /cases/{system_id}/close
HTTP Method PUT Path /cases/{system_id}/close Description Closes the case with specified system id. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body CaseBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case successfully closed.
304 Not Modified – Case not closed. 404 Not Found – Case not found.
Body CaseBean - success. ErrorBean - failure.
Request example:
PUT /cases/Task-sp-3/close
PUT /cases/{system_id}/close_with_related
HTTP Method PUT Path /cases/{system_id}/close_with_related Description Closes the case with specified system id and closes it’s related cases
(cases for which case with system id “system_id” is their parent). Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body CaseBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case successfully closed.
304 Not Modified – Case not closed. 404 Not Found – Case not found.
Body CaseBean - success. ErrorBean - failure.
87 Workflow API © 2018 SAP, Inc. All Rights Reserved.
POST /cases/create_bulk
HTTP Method POST Path /cases/create_bulk Description Creates a list of cases based on received list of caseBean objects.
Case creator - user who is performing REST API call. Case updater - user who is performing REST API call.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body List of CaseBean objects Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Cases successfully created.
404 Not Found – Any child entity (account, contact, creator etc.) with sent system_id not found.
Body processed_entities - success. errors – failure.
JSON example:
a) POST /cases/create_bulk User performing REST call is jsmith. Request body:
[{ "case_type_system_id": "Task", "description": "This case is created via REST API.", "name": "REST API - Case 1", "project_system_id": "sp", "owner_system_id": "jsmith", "assignees": [{ "system_id": "jsmith" }, { "system_id": "tsmith" }], "custom_fields": [{ "system_id": "duration", "value": "20" }, { "system_id": "effort_left", "value": "15" }], "related_to_cases": [{ "system_id": "Task-sp-1" }, { "system_id": "Task-sp-2" }] },
88 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
{ "case_type_system_id": "nonexistent", "description": "This case is created via REST API.", "name": "REST API - Case 2", "project_system_id": "nonexistent", "status_system_id": "nonexistent", "contact_system_id": "nonexistent", "account_system_id": "nonexistent", "priority_system_id": "nonexistent", "owner_system_id": "nonexistent", "assignees": [{ "system_id": "jsmith" }, { "system_id": "tsmith" }], "custom_fields": [{ "system_id": "duration", "value": "20" }, { "system_id": "effort_left", "value": "15" }], "related_to_cases": [{ "system_id": "Task-sp-1" }, { "system_id": "Task-sp-2" }] }]
{ "errors": [ { "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Case type does not exist.", "Status does not exist.", "Priority does not exist.", "Project does not exist.", "Account does not exist.", "Contact does not exist.", "Owner does not exist." ], "failed_index": 2 } ], "processed_entities": [ { "name": "REST API - Case 1", "case_key": "Task-sp-24", "system_id": "task-sp-24", "description": "This case is created via REST API.", "closed": false, "created_on": "09/01/2016 10:24:57", "updated_on": "09/01/2016 10:24:57", "case_type": { "name": "Task", "unique_key": "task", "system_id": "task" },
89 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"status": { "name": "Closed", "system_id": "closed" }, "priority": { "name": "Critical", "system_id": "Critical" }, "project": { "name": "sp", "system_id": "sp", "is_default": false, "uri": "http://localhost:8080/wpm/api/projects/sp" },
}, "creator": { "login_name": "rest", "first_name": "rest", "last_name": "", "user_type": { "name": "Internal User", "system_id": "internal_user" }, "system_id": "rest", "uri": "http://localhost:8080/wpm/api/users/rest" }, "updater": { "login_name": "rest", "first_name": "rest", "last_name": "", "user_type": { "name": "Internal User", "system_id": "internal_user" }, "system_id": "rest", "uri": "http://localhost:8080/wpm/api/users/rest" }, "owner": { "login_name": "jsmith", "first_name": "John", "last_name": "Smith", "user_type": { "name": "Internal User", "system_id": "internal_user" }, "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith" },
90 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"assignees": [ { "login_name": "jsmith", "first_name": "John", "last_name": "Smith", "user_type": { "name": "Internal User", "system_id": "internal_user" }, "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith" } ], "related_to_cases": [ { "name": "REST API - Case 2", "case_key": "Task-sp-2", "system_id": "task-sp-2", "uri": "http://localhost:8080/wpm/api/cases/task-sp-2" }, { "name": "REST API - Case 1", "case_key": "Task-sp-1", "system_id": "task-sp-1", "uri": "http://localhost:8080/wpm/api/cases/task-sp-1" }
91 Workflow API © 2018 SAP, Inc. All Rights Reserved.
b) If case type, owner, project, status, priority, account, contact with sent system_id does not exist:
Errors - List of messages with error details Failed_index - Index of case with bad request.
"errors": [ { "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Case type does not exist.", "Owner does not exist.", "Project does not exist.", "Status does not exist.", "Priority does not exist.", "Account does not exist.", "Contact does not exist.", ], "failed_index": 1 } ]
92 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /cases/update_bulk
HTTP Method PUT Path /cases/update_bulk Description Updates a list of cases based on received list of caseBean objects.
Case updater - user who is performing REST API call. Important note: Case Type and Project cannot be changed using this
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body List of CaseBean objects Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case successfully updated.
404 Not Found – Case or any child entity with sent system_id not found.
Body processed_entities - success. errors – failure.
JSON example:
PUT/cases/update_bulk
User performing REST call is jsmith. Request body:
[{ "system_id": "Task-sp-1", "case_type_system_id": "Task", "description": "This case is updated via REST API.", "name": "REST API - Case 1 UPDATED", "project_system_id": "sp", "owner_system_id": "jsmith", "assignees": [{ "system_id": "jsmith" }, { "system_id": "tsmith" }],
93 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"custom_fields": [{ "system_id": "duration", "value": "20" }, { "system_id": "effort_left", "value": "15" }], "related_to_cases": [{ "system_id": "Task-sp-1" }, { "system_id": "Task-sp-2" }] }, { "system_id": "Task-sp-2", "case_type_system_id": "Task", "description": "This case is updated via REST API.", "name": "REST API - Case 2 UPDATED", "project_system_id": "nonexistent", "status_system_id": "nonexistent", "contact_system_id": "nonexistent", "account_system_id": "nonexistent", "priority_system_id": "nonexistent", "owner_system_id": "nonexistent", "assignees": [{ "system_id": "jsmith" }, { "system_id": "tsmith" }], "custom_fields": [{ "system_id": "duration", "value": "20" }, { "system_id": "effort_left", "value": "15" }], "related_to_cases": [{ "system_id": "Task-sp-1" }, { "system_id": "Task-sp-2" }] }]
94 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
{ "errors": [ { "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Status does not exist.", "Priority does not exist.", "Account does not exist.", "Contact does not exist.", "Owner does not exist." ], "failed_index": 2 } ], "processed_entities": [ { "name": "REST API - Case 1 UPDATED", "case_key": "Task-sp-1", "system_id": "task-sp-1", "description": "This case is updated via REST API.", "closed": false, "created_on": "08/31/2016 16:48:51", "updated_on": "09/01/2016 11:04:26", "case_type": { "name": "Task", "unique_key": "task", "system_id": "task" }, "status": { "name": "Closed", "system_id": "closed" }, "priority": { "name": "Critical", "system_id": "Critical" }, "project": { "name": "sp", "system_id": "sp", "is_default": false, "uri": "http://localhost:8080/wpm/api/projects/sp" }, "creator": { "login_name": "rest", "first_name": "rest", "last_name": "", "user_type": { "name": "Internal User", "system_id": "internal_user" }, "system_id": "rest", "uri": "http://localhost:8080/wpm/api/users/rest" }, "updater": { "login_name": "rest", "first_name": "rest", "last_name": "", "user_type": { "name": "Internal User", "system_id": "internal_user" }, "system_id": "rest", "uri": "http://localhost:8080/wpm/api/users/rest" },
95 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"owner": { "login_name": "jsmith", "first_name": "John", "last_name": "Smith", "user_type": { "name": "Internal User", "system_id": "internal_user" }, "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith" }, "assignees": [ { "login_name": "jsmith", "first_name": "John", "last_name": "Smith", "user_type": { "name": "Internal User", "system_id": "internal_user" }, "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith" } ], "related_to_cases": [ { "name": "REST API - Case 2 UPDATED", "case_key": "Task-sp-2", "system_id": "task-sp-2", "uri": "http://localhost:8080/wpm/api/cases/task-sp-2" }, { "name": "REST API - Case 1 UPDATED", "case_key": "Task-sp-1", "system_id": "task-sp-1", "uri": "http://localhost:8080/wpm/api/cases/task-sp-1" } ], "related_from_cases": [ { "name": "REST API - Case 2 UPDATED", "case_key": "Task-sp-2", "system_id": "task-sp-2", "uri": "http://localhost:8080/wpm/api/cases/task-sp-2" }, { "name": "REST API - Case 1", "case_key": "Task-sp-21", "system_id": "task-sp-21", "uri": "http://localhost:8080/wpm/api/cases/task-sp-21" }, { "name": "REST API - Case 1", "case_key": "Task-sp-24", "system_id": "task-sp-24", "uri": "http://localhost:8080/wpm/api/cases/task-sp-24" }, { "name": "REST API - Case 2", "case_key": "Task-sp-3", "system_id": "task-sp-3", "uri": "http://localhost:8080/wpm/api/cases/task-sp-3" }, { "name": "REST API - Case 1 UPDATED", "case_key": "Task-sp-1", "system_id": "task-sp-1", "uri": "http://localhost:8080/wpm/api/cases/task-sp-1" },
96 Workflow API © 2018 SAP, Inc. All Rights Reserved.
{ "name": "REST API - Case 1", "case_key": "Task-sp-22", "system_id": "task-sp-22", "uri": "http://localhost:8080/wpm/api/cases/task-sp-22" }, { "name": "REST API - Case 1", "case_key": "Task-sp-23", "system_id": "task-sp-23", "uri": "http://localhost:8080/wpm/api/cases/task-sp-23" } ], "uri": "http://localhost:8080/wpm/api/cases/task-sp-1", "case_url": "http://localhost:8080/wpm/mt/junit/projects/sp/task-1" } ] }
97 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/list/{system_id}
HTTP Method GET Path /cases/list/{system_id} Description Returns cases which belong to the list with specified system id.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/list/list_of_tasks?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case list found.
404 Not Found – Case not found. Body ResultBean with a list of CaseBeans - success.
ErrorBean - failure.
JSON example:
a) List with system_id “list_of_tasks” contains 2 cases:
GET /cases/list/list_of_tasks?page=1&page_size=10
Response body:
{ "cases": [ {
"assignees": [ { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
98 Workflow API © 2018 SAP, Inc. All Rights Reserved.
name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-3", "case_type": { "name": "Bug", "system_id": "bug", "unique_key": "bug"
}, "closed": false, "created_on": "09/10/13 14:50:49", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ { "name": "Duration", "system_id": "durationw "type_name": "Number", "type_system_id": 2, "value": "20", "value_formatted": "20"
}, { "name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "5", "value_formatted": "5"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 3 - UPDATED", "owner": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
99 Workflow API © 2018 SAP, Inc. All Rights Reserved.
}, "system_id": "Task-sp-3", "updated_on": "09/10/13 16:54:34", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-3"
}, {
"assignees": [ { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-5", "case_type": { "name": "Bug", "system_id": "bug", "unique_key": "bug"
}, "closed": false, "created_on": "09/10/13 15:55:32", "creator": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ { "name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "1", "value_formatted": "1"
}, { "name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "20", "value_formatted": "20"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 3 - UPDATED",
91 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"owner": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-5", "updated_on": "09/10/13 17:07:04", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-5"
} ], "completed_in": 0, "page": 1, "page_size": 10, "total": 2
}
b) GET /cases/list/some_non_existing_list
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Case list does not exist."
] }
92 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/smart_list/{system_id}
HTTP Method GET Path /cases/smart_list/{system_id} Description Returns cases which belong to the smart list with specified system id.
In other words, returns cases which satisfy search criteria saved by smart list.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/smart_list/toms_smart_list?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Smart list found.
404 Not Found – Smart list not found. Body ResultBean with a list of CaseBeans - success.
ErrorBean - failure.
JSON example:
a) Smart list with system id “toms_smart_list” returns cases where John Smith and Tom Smith are assignees, Tom Smith is case owner and cases belong to Sales Project. List returns two cases.
GET /cases/smart_list/toms_smart_list?page=1&page_size=10
Response body:
{ "cases": [ {
"assignees": [ { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
}
93 Workflow API © 2018 SAP, Inc. All Rights Reserved.
} ], "case_key": "Task-sp-3", "case_type": { "name": "Bug", "system_id": "bug", "unique_key": "bug"
}, "closed": false, "created_on": "09/10/13 14:50:49", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ { "name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "20", "value_formatted": "20"
}, { "name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "5", "value_formatted": "5"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 3 - UPDATED", "owner": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-3", "updated_on": "09/10/13 16:54:34",
94 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"updater": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-3"
}, {
"assignees": [ { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-5", "case_type": { "name": "Bug", "system_id": "bug", "unique_key": "bug"
}, "closed": false, "created_on": "09/10/13 15:55:32", "creator": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ { "name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "1", "value_formatted": "1"
}, { "name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "20", "value_formatted": "20"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 3 - UPDATED", "owner": { "first_name": "Tom", "last_name": "Smith",
95 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-5", "updated_on": "09/10/13 17:07:04", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-5"
} ], "completed_in": 0, "page": 1, "page_size": 10, "total": 2
}
b) GET /cases/smart_list/some_non_existing_smart_list
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Smart list does not exist."
] }
96 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/system_list/creator
HTTP Method GET Path /cases/system_list/creator Description Returns a list of cases in which user performing the REST call is the
creator.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/system_list/creator?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with a list of CaseBeans - success.
JSON example:
John Smith created one case.
GET /cases/system_list/creator?page=1&page_size=10
Response body:
{ "cases": [
{ "assignees": [
{ "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-8", "case_type": {
"name": "Task", "system_id": "task",
97 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"unique_key": "task" }, "closed": false, "created_on": "10/10/13 14:41:18", "creator": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [
{ "name": "Refresh List", "system_id": "refresh_list", "type_name": "Checkbox", "type_system_id": 8
} ], "description": "", "name": "Test Case 1", "priority": {
"name": "Low", "system_id": "Trivial"
}, "project": {
"description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": {
"name": "Described", "system_id": "described"
}, "system_id": "Task-sp-8", "updated_on": "10/10/13 14:42:07", "updater": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-8"
} ], "completed_in": 0, "page": 1, "page_size": 10, "total": 1
}
98 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/system_list/creator/{user_system_id}
HTTP Method GET Path /cases/smart_list/creator/{user_system_id} Description Returns a list of cases in which user with specified system id is the
creator.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/smart_list/creator/tsmith?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User found.
404 Not Found – User not found. Body ResultBean with a list of CaseBeans - success.
ErrorBean - failure.
JSON example:
Tom Smith created one case. REST call is performed by John Smith and he needs a list of cases created by Tom Smith.
GET /cases/system_list/creator/tsmith?page=1&page_size=10
Response body:
{ "cases": [ {
"assignees": [ { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
],
99 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"case_key": "Task-sp-5", "case_type": { "name": "Bug", "system_id": "bug", "unique_key": "bug"
}, "closed": false, "created_on": "09/10/13 15:55:32", "creator": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ { "name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "1", "value_formatted": "1"
}, { "name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "20", "value_formatted": "20"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 3 - UPDATED", "owner": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-5", "updated_on": "09/10/13 17:07:04", "updater": { "first_name": "John",
100 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-5"
} ], "completed_in": 0, "page": 1, "page_size": 10, "total": 1
}
GET /cases/system_list/assignee
HTTP Method GET Path /cases/system_list/assignee Description Returns a list of cases in which user performing the REST call is the
assignee.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/system_list/assignee?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with a list of CaseBeans - success.
Request example:
GET /cases/system_list/assignee?page=1&page_size=10
Response body has the same format as in GET /cases/system_list/creator.
101 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/system_list/assignee/{user_system_id}
HTTP Method GET Path /cases/smart_list/assignee/{user_system_id} Description Returns a list of cases in which user with specified system id is the
assignee.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/smart_list/assignee/tsmith?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User found.
404 Not Found – User not found. Body ResultBean with a list of CaseBeans - success.
ErrorBean - failure.
Request example:
GET /cases/system_list/assignee/tsmith?page=1&page_size=10
Response body has the same format as in GET /cases/system_list/creator/{user_system_id}.
102 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/system_list/owner
HTTP Method GET Path /cases/system_list/owner Description Returns a list of cases in which user performing the REST call is the
owner.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/system_list/owner?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with a list of CaseBeans - success.
Request example:
GET /cases/system_list/owner?page=1&page_size=10
Response body has the same format as in GET /cases/system_list/creator.
1. GET /cases/system_list/owner/{user_system_id}
HTTP Method GET Path /cases/smart_list/owner/{user_system_id} Description Returns a list of cases in which user with specified system id is the
owner.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/smart_list/owner/tsmith?page=1&page_size=10
Required headers Authorization, domain, Accept
103 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User found.
404 Not Found – User not found. Body ResultBean with a list of CaseBeans - success.
ErrorBean - failure.
Request example:
GET /cases/system_list/owner/tsmith?page=1&page_size=10
Response body has the same format as in GET /cases/system_list/creator/{user_system_id}.
GET /cases/system_list/team_member
HTTP Method GET Path /cases/system_list/team_member Description Returns a list of cases in which user performing the REST call is the
team member.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/system_list/team_member?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with a list of CaseBeans - success.
Request example:
GET /cases/system_list/team_member?page=1&page_size=10
104 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body has the same format as in GET /cases/system_list/creator.
GET /cases/system_list/team_member/{user_system_id}
HTTP Method GET Path /cases/smart_list/team_member/{user_system_id} Description Returns a list of cases in which user with specified system id is the
team member.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/smart_list/team_member/tsmith?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User found.
404 Not Found – User not found. Body ResultBean with a list of CaseBeans - success.
ErrorBean - failure.
Request example:
GET /cases/system_list/team_member/tsmith?page=1&page_size=10
Response body has the same format as in GET /cases/system_list/creator/{user_system_id}.
GET /cases/system_list/referral
HTTP Method GET Path /cases/system_list/referral Description Returns a list of cases in which user performing the REST call is the
referral.
Available search attributes:
105 Workflow API © 2018 SAP, Inc. All Rights Reserved.
page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/system_list/referral?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with a list of CaseBeans - success.
106 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request example:
GET /cases/system_list/referral?page=1&page_size=10
Response body has the same format as in GET /cases/system_list/creator.
GET /cases/system_list/referral/{user_system_id}
HTTP Method GET Path /cases/smart_list/referral/{user_system_id} Description Returns a list of cases in which user with specified system id is the
referral.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/smart_list/referral/tsmith?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User found.
404 Not Found – User not found. Body ResultBean with a list of CaseBeans - success.
ErrorBean - failure.
Request example:
GET /cases/system_list/referral/tsmith?page=1&page_size=10
Response body has the same format as in GET /cases/system_list/creator/{user_system_id}.
107 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/system_list/follower
HTTP Method GET Path /cases/system_list/follower Description Returns a list of cases in which user performing the REST call is the
follower.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/system_list/follower?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with a list of CaseBeans - success.
Request example:
GET /cases/system_list/follower?page=1&page_size=10
Response body has the same format as in GET /cases/system_list/creator.
108 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/system_list/follower/{user_system_id}
HTTP Method GET Path /cases/smart_list/follower/{user_system_id} Description Returns a list of cases in which user with specified system id is the
follower.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /cases/smart_list/follower/tsmith?page=1&page_size=10
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User found.
404 Not Found – User not found. Body ResultBean with a list of CaseBeans - success.
ErrorBean - failure.
Request example:
GET /cases/system_list/follower/tsmith?page=1&page_size=10
Response body has the same format as in GET /cases/system_list/creator/{user_system_id}.
109 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/{system_id}/related_cases
HTTP Method GET Path /cases/{system_id}/related_cases Description Returns a list of related cases for case with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request – Input Accepts application/json Expected request body N/A Response – Output Return MIME Type application/json HTTP Status Code 200 OK – Case found.
404 Not Found – Case not found. Body A list of CaseBeans - success.
ErrorBean - failure.
JSON example:
Case Task-sp-3 has two related cases.
GET /cases/Task-sp-3/related_cases
Response body:
[ { "case_key": "Task-sp-1", "name": "REST API - Case 1", "system_id": "Task-sp-1", "uri": "http://localhost:8080/wpm/api/cases/Task-sp-1"
}, { "case_key": "Task-sp-2", "name": "REST API - Case 2", "system_id": "Task-sp-2", "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
} ]
110 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/{system_id}/related_cases/inverse
HTTP Method GET Path /cases/{system_id}/related_cases/inverse Description Returns a list of all cases from which case with specified system id is
related. Required headers Authorization, domain, Accept Returned headers Content-Type Request – Input Accepts application/json Expected request body N/A Response – Output Return MIME Type application/json HTTP Status Code 200 OK – Case found.
404 Not Found – Case not found. Body A list of CaseBeans - success.
ErrorBean - failure.
JSON example:
Case Task-sp-3 is related from two cases: Task-sp-4 and Task-sp-5. In other words, cases Task-sp-4 and case Task-sp-5 have realted case Task-sp-3.
GET /cases/Task-sp-3/related_cases/inverse
Response body:
[ { "case_key": "Task-sp-4", "name": "Task 4", "system_id": "Task-sp-4", "uri": "http://localhost:8080/wpm/api/cases/Task-sp-4"
}, { "case_key": "Task-sp-5", "name": "Task 5", "system_id": "Task-sp-5", "uri": "http://localhost:8080/wpm/api/cases/Task-sp-5"
} ]
111 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /cases/{system_id}/related_cases/{related_system_id}
HTTP Method PUT Path /cases/{system_id}/related_cases/{related_system_id} Description Creates a relation between two existing cases. To case with system id
"system_id" it sets related case with system id "related_system_id". Required headers Authorization, domain, Accept Returned headers Content-Type Request – Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Cases successfully related.
400 Bad Request – Relation already exists. 404 Not Found – Cases not found.
Body ErrorBean - failure.
Request example:
PUT /cases/Task-sp-3/related_cases/Task-sp-7
DELETE /cases/{system_id}/related_cases/{related_system_id}
HTTP Method DELETE Path /cases/{system_id}/related_cases/{related_system_id} Description Deletes the relation between case with system id "system_id" and its
related case with system id "related_system_id". Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Relation between cases successfully deleted.
400 Bad Request – Cases are not related. 404 Not Found – Cases not found.
Body ErrorBean - failure.
Request example: DELETE /cases/Task-sp-3/related_cases/Task-sp-7
112 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/{system_id}/custom_fields/{custom_field_system_id}
HTTP Method GET Path /cases/{system_id}/custom_fields/{custom_field_system_id} Description Returns specified custom field with its value which is set for specified
case. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Field found.
404 Not Found – Case or Custom Field not found. Body CustomFieldBean - success.
ErrorBean - failure.
JSON example:
GET /cases/Task-sp-1/custom_fields/duration
Response body:
{ "name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "10", "value_formatted": "10"
}
113 Workflow API © 2018 SAP, Inc. All Rights Reserved.
POST /cases/{system_id}/custom_fields
HTTP Method POST Path /cases/{system_id}/custom_fields Description Sets custom field value in specified case based on received
CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Custom Field value set successfully.
400 Bad Request – Custom Field value is not in the right format. 404 Not Found – Case or Custom Field not found
Body CaseBean - success. ErrorBean - failure.
JSON example:
POST /cases/Task-sp-1/custom_fields
Request body:
Response body:
{ "system_id": "due_date", "value": "12/26/15"
}
{ "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith",
114 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-1", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "created_on": "09/10/13 14:35:09", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ {
"name": "Due Date", "system_id": "due_date", "type_name": "Date", "type_system_id": 3, "value": "12/26/15", "value_formatted": "26/12/15"
}, {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "3", "value_formatted": "3"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "10", "value_formatted": "10"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 1", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": {
115 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-1", "updated_on": "10/10/13 16:17:09", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-1"
}
PUT /cases/{system_id}/custom_fields
HTTP Method PUT Path /cases/{system_id}/custom_fields Description Updates custom field value in specified case based on received
CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 200 OK – Custom Field value set successfully.
400 Bad Request – Custom Field value is not in the right format. 404 Not Found – Case or Custom Field not found
Body CaseBean - success. ErrorBean - failure.
JSON example:
PUT /cases/Task-sp-1/custom_fields
116 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request body:
Response body:
{ "system_id": "due_date", "value": "01/15/16"
}
{ "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-1", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "created_on": "09/10/13 14:35:09", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "custom_fields": [ {
"name": "Due Date", "system_id": "due_date", "type_name": "Date", "type_system_id": 3, "value": "01/15/16", "value_formatted": "15/01/16"
},
117 Workflow API © 2018 SAP, Inc. All Rights Reserved.
{ "name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "3", "value_formatted": "3"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "10", "value_formatted": "10"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 1", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-1", "updated_on": "10/10/13 16:21:10", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-1"
}
118 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DELETE /cases/{system_id}/custom_fields/{custom_field_system_id}
HTTP Method DELETE Path /cases/{system_id}/custom_fields/{custom_field_system_id} Description Deletes the value of specified custom field in specified case. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom field value successfully deleted.
404 Not Found – Case or Custom Field not found. Body ErrorBean - failure.
Request example: DELETE /cases/Task-sp-1/custom_fields/due_date
GET /cases/{system_id}/attachments
HTTP Method GET Path /cases/{system_id}/attachments Description Returns a list of attachments from specified case which user who is
performing a REST call has permission to see. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case found.
404 Not Found – Case not found. Body List of AttachmentBean objects - success.
ErrorBean - failure.
119 Workflow API © 2018 SAP, Inc. All Rights Reserved.
JSON example:
There are four attachments in case Task-sp-1:
1. name: a1-public-jsmith.txt visibility: public uploaded by: Jonh Smith uploaders company: My Company Inc.
2. name: a2-public-jane.txt visibility: public uploaded by: Jane Smith uploaders company: Other Company Inc.
3. name: a3-internal-jsmith.txt visibility: internal uploaded by: Jonh Smith uploaders company: My Company Inc.
4. name: a4-internal-jane.txt visibility: internal uploaded by: Jane Smith uploaders company: Other Company Inc.
John Smith can see attachments: 1 (public), 2 (public) and 3 (internal from his company). Jane Smith can see attachments: 1 (public), 2 (public) and 4 (internal from her company).
a) John is performing REST call:
GET /cases/Task-sp-1/attachments
Response body:
[ { "download_link": "http://localhost:8080/wpm/downloadDocument.do?attachId=29156&tenantName=default", "internal": false, "name": "a1-public-jsmith.txt", "system_id": "29156", "uploader": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }
}, { "download_link": "http://localhost:8080/wpm/downloadDocument.do?attachId=29158&tenantName=default", "internal": false, "name": "a2-public-jane.txt", "system_id": "29158", "uploader": {
"first_name": "Jane", "last_name": "Smith", "login_name": "jane", "system_id": "jane", "uri": "http://localhost:8080/wpm/api/users/jane", "user_type": { "name": "Partner", "system_id": "partner"
} }
}, { "company": {
"name": "My Company Inc.",
120 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/my_company_inc"
}, "download_link": "http://localhost:8080/wpm/downloadDocument.do?attachId=29157&tenantName=default", "internal": true, "name": "a3-internal-jsmith.txt", "system_id": "29157", "uploader": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }
} ]
b) Jane is performing REST call:
GET /cases/Task-sp-1/attachments
Response body:
[ { "download_link": "http://localhost:8080/wpm/downloadDocument.do?attachId=29158&tenantName=default", "internal": false, "name": "a2-public-jane.txt", "system_id": "29158", "uploader": {
"first_name": "Jane", "last_name": "Smith", "login_name": "jane", "system_id": "jane", "uri": "http://localhost:8080/wpm/api/users/jane", "user_type": { "name": "Partner", "system_id": "partner"
} }
}, { "download_link": "http://localhost:8080/wpm/downloadDocument.do?attachId=29156&tenantName=default", "internal": false, "name": "a1-public-jsmith.txt", "system_id": "29156", "uploader": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }
}, { "company": {
"name": "Other Company Inc.",
121 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "other_company_inc", "uri": "http://localhost:8080/wpm/api/companies/other_company_inc"
}, "download_link": "http://localhost:8080/wpm/downloadDocument.do?attachId=29151&tenantName=default", "internal": true, "name": "a4-internal-jane.txt", "system_id": "29151", "uploader": {
"first_name": "Jane", "last_name": "Smith", "login_name": "jane", "system_id": "jane", "uri": "http://localhost:8080/wpm/api/users/jane", "user_type": { "name": "Partner", "system_id": "partner"
} }
} ]
GET /cases/{system_id}/attachments/{attachment_system_id}
HTTP Method GET Path /cases/{system_id}/attachments/{attachment_system_id} Description Returns (downloads) attached file with specified attachment system id
from case with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/octet-stream Expected request body N/A Response - Output Return MIME Type application/octet-stream HTTP Status Code 200 OK – Case found.
400 Bad Request – Case does not contain specified attachment. 403 Forbidden – Attachment is not visible for requester. 404 Not Found – Case or Attachment not found.
Body List of AttachmentBean objects - success. ErrorBean - failure.
JSON example:
a) Jonh is performing REST call and he want to download attachment “a1-public-jsmith.txt” with system_id 29151.
GET cases/Task-sp-1/attachments/29151
122 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
Response headers:
b) Jonh is performing REST call and he want to download attachment “a4-internal-jane.txt” with system_id 29155.
GET /cases/Task-sp-1/attachments/29155
Response body:
c) Jane is performing REST call and she wants to download attachment “a1-public-jane.txt”
with system_id 29158.
GET cases/Task-sp-1/attachments/29158
Response body:
Response headers:
d) Jane is performing REST call and she wants to download attachment “a3-internal-jsmith.txt” with system_id 29157.
GET /cases/Task-sp-1/attachments/29157
This is a public attachment uploaded by Jonh Smith from My Company Inc.
Content-Disposition: attachment; filename="a1-public-jsmith.txt" Content-Type: application/octet-stream
{ "error_code": "PERMISSION_DENIED", "error_messages": [ "You do not have permission to download this attachment."
] }
This is a public attachment uploaded by Jane Smith from Other Company Inc.
Content-Disposition: attachment; filename="a2-public-jane.txt" Content-Type: application/octet-stream
123 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
POST /cases/{system_id}/attachments
HTTP Method POST Path /cases/{system_id}/attachments Description Uploads attachment to specified case.
Request must have the following header: Content-Type: multipart/form-data; boundary= …
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body 1. Attachment visibility (true/false) sent as form field with name
“internal”. 2. File with size lesoctets than 20MB uploaded as form field with
name “uploaded_file”. Response - Output Returned MIME Type application/json HTTP Status Code 201 OK – File successfully uploaded.
400 Bad Request – File not sent; file larger than 20MB 404 Not Found – Case not found.
Body AttachmentBean - success. ErrorBean - failure.
Example HTML form:
{ "error_code": "PERMISSION_DENIED", "error_messages": [ "You do not have permission to download this attachment."
] }
<html> <head> </head> <body>
<form action="http://localhost:8080/wpm/api/cases/Task-sp-1/attachments" enctype="multipart/form-data" method="post"> File: <input type="file" name="uploaded_file"> Visibility: <input type="radio" value="false" name="internal">Public <input type="radio" value="true" name="internal">Internal <input type="submit" value="Attach File" />
</form> </body>
</html>
124 Workflow API © 2018 SAP, Inc. All Rights Reserved.
a) Jonh Smith is uploading public attachment:
POST /cases/Task-sp-1/attachments
Response body:
b) John Smith is uploading internal attachment
POST /cases/Task-sp-1/attachments
Response body:
{ "download_link": "http://localhost:8080/wpm/downloadDocument.do?attachId=29170&tenantName=default", "internal": false, "name": "public_attachment_123_jsmith.txt", "system_id": "29170", "uploader": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }
}
{ "company": { "name": "My Company Inc.", "system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/my_company_inc"
}, "download_link": "http://localhost:8080/wpm/downloadDocument.do?attachId=29171&tenantName=default", "internal": true, "name": "internal_attachment_123_jsmith.txt", "system_id": "29171", "uploader": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith",
125 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"user_type": { "name": "Partner", "system_id": "partner"
} }
}
DELETE /cases/{system_id}/attachments/{attachment_system_id}
HTTP Method DELETE Path /cases/{system_id}/attachments/{attachment_system_id} Description Deletes the attachment with specified attachment system id from
specified case. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Attachment successfully deleted.
400 Bad Request – Case does not contain specified attachment. 403 Forbidden – Requester does not have permission to delete the attachment. 404 Not Found – Case or attachment not found.
Body ErrorBean - failure.
JSON example:
a) John wants to delete public attachment “a2-public-jane.txt” with system_id 29158.
DELETE /cases/Task-sp-1/attachments/29158
b) John wants to delete internal attachment “a4-internal-jane.txt” with system_id 29151.
DELETE /cases/Task-sp-1/attachments/29151
{ "error_code": "PERMISSION_DENIED", "error_messages": [ "You do not have permission to delete this attachment."
] }
126 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/{system_id}/comments
HTTP Method GET Path /cases/{system_id}/comments Description Returns a list of comments from specified case which user who is
performing a REST call has permission to see. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case found.
404 Not Found – Case not found. Body List of CommentBean objects - success.
ErrorBean - failure.
JSON example:
There are five comments in case Task-sp-2:
1. Public comment by John Smith comment: Public - John visibility: public author: John Smith author’s company: My Company Inc. system_id: 158868
2. Internal comment by Jonh Smith. comment: Internal - John visibility: internal author: John Smith author’s company: My Company Inc. system_id: 158869
3. Public comment by Jane Smith comment: Public - Jane visibility: public author: Jane Smith author’s company: Other Company Inc. system_id: 158871
4. Internal comment by Jane Smith comment: Internal - Jane visibility: internal author: Jane Smith author’s company: Other Company Inc. system_id: 158872
5. Public comment by John - Reply to Jane's public comment.
comment: Public - John - Reply to Jane's public comment. visibility: public
127 Workflow API © 2018 SAP, Inc. All Rights Reserved.
author: John Smith author’s company: My Company Inc. system_id: 158875 parent_system_id: 158871
John Smith can see comments: 1 (public), 2 (internal from his company) and 3 (public) and 5 (public). Jane Smith can see comments: 1 (public), 3 (public) and 4 (internal from her company) and 5 (public).
a) John is performing REST call:
GET /cases/Task-sp-2/comments
Response body:
[ { "author": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }, "comment": "Public - John - Reply to Jane's public comment.", "created_on": "11/02/14 11:48:12", "internal": false, "parent_system_id": "158871", "system_id": "158875", "updated_on": "13/02/14 16:19:37", "updater": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }
}, { "author": {
"first_name": "Jane", "last_name": "Smith", "login_name": "jane", "system_id": "jane", "uri": "http://localhost:8080/wpm/api/users/jane", "user_type": { "name": "Partner", "system_id": "partner"
} }, "comment": "Public - Jane", "created_on": "12/02/14 09:16:51", "internal": false,
128 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "158871" }, { "author": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }, "comment": "Internal - John", "created_on": "11/02/14 12:26:03", "company": {
"name": "My Company Inc.", "system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/my_company_inc"
}, "internal": true, "system_id": "158869"
}, { "author": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }, "comment": "Public - John", "created_on": "11/02/14 11:48:12", "internal": false, "system_id": "158868"
} ]
b) Jane is performing REST call:
GET /cases/Task-sp-1/comments
Response body:
[ { "author": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }, "comment": "Public - John - Reply to Jane's public comment.", "created_on": "11/02/14 11:48:12", "internal": false,
129 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"parent_system_id": "158871", "system_id": "158875", "updated_on": "13/02/14 16:19:37", "updater": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }
}, { "author": {
"first_name": "Jane", "last_name": "Smith", "login_name": "jane", "system_id": "jane", "uri": "http://localhost:8080/wpm/api/users/jane", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "comment": "Internal - Jane", "created_on": "11/02/14 12:31:14", "company": {
"name": "Other Company Inc.", "system_id": "other_company_inc", "uri": "http://localhost:8080/wpm/api/companies/other_company_inc"
}, "internal": true, "system_id": "158872"
}, { "author": {
"first_name": "Jane", "last_name": "Smith", "login_name": "jane", "system_id": "jane", "uri": "http://localhost:8080/wpm/api/users/jane", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "comment": "Public - Jane", "created_on": "12/02/14 09:16:51", "internal": false, "system_id": "158871"
}, { "author": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "comment": "Public - John", "created_on": "11/02/14 11:48:12", "internal": false,
130 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "158868" }
]
GET /cases/{system_id}/comments/{comment_system_id}
HTTP Method GET Path /cases/{system_id}/comments/{comment_system_id} Description Returns a comment with specified comment system id from specified
case. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case and comment found.
400 Bad Request – Case does not contain requested comment. 403 Forbidden - User does not have permission to read specified comment. 404 Not Found – Case or comment not found.
Body CommentBean - success. ErrorBean - failure.
JSON example:
a) Jonh is requesting his public comment.
GET /cases/Task-sp-1/comments/158868
Response body:
b) John is requesting Jane’s internal comment.
{ "author": { "first_name":
"John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "comment": "Public - John", "created_on": "11/02/14 11:48:12", "internal": false, "system_id": "158868"
}
131 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/Task-sp-1/comments/158872
Reponse body:
POST /cases/{system_id}/comments
HTTP Method POST Path /cases/{system_id}/comments Description 1. Creates a comment based on received CommentBean in case
with specified system id. 2. Creates a reply to comment with system id
“parent_system_id” if “parent_system_id” is sent via CommentBean.
In both cases, if author_system_id is left out, user performing REST API call will be set as comment author.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CommentBean Response - Output Returned MIME Type application/json HTTP Status Code 201 OK – Comment successfully added.
403 Forbidden – User does not have permission to reply to specified comment with system id “parent_system_id”. 404 Not Found – Case not found.
Body CommentBean - success. ErrorBean - failure.
JSON example:
a) Public comment by John Smith
POST /cases/Task-sp-2/comments
{ "error_code": "PERMISSION_DENIED", "error_messages": [ "You do not have permission to read this comment."
] }
132 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request body:
Response body:
b) Internal comment by Jonh Smith. (John is performing REST API call and author_system_id is not sent.)
POST /cases/Task-sp-2/comments
Request body:
Response body:
{ "comment": "Public - John", "internal": "false", "author_system_id": "jsmith"
}
{ "author": { "first_name":
"John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "comment": "Public - John", "created_on": "11/02/14 11:48:12", "internal": false, "system_id": "158868"
}
{ "comment": "Internal - John", "internal": "true"
}
{ "author": { "first_name":
"John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "comment": "Internal - John",
133 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"created_on": "11/02/14 12:26:03", "company": { "name": "My Company Inc.", "system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/my_company_inc"
}, "internal": true, "system_id": "158869"
}
c) Public comment by Jane Smith
POST /cases/Task-sp-2/comments
Request body:
Reponse body:
d) Internal comment by Jane Smith.
POST /cases/Task-sp-2/comments
Request body:
Reponse body:
{ "comment": "Public - Jane", "internal": "false"
}
{ "author": {
"first_name": "Jane", "last_name": "Smith", "login_name": "jane", "system_id": "jane", "uri": "http://localhost:8080/wpm/api/users/jane", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "comment": "Public - Jane", "created_on": "12/02/14 09:16:51", "internal": false, "system_id": "158871"
}
{ "comment": "Internal - Jane", "internal": "true"
}
{
134 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"author": { "first_name": "Jane", "last_name": "Smith", "login_name": "jane", "system_id": "jane", "uri": "http://localhost:8080/wpm/api/users/jane", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "comment": "Internal - Jane", "created_on": "11/02/14 12:31:14", "company": { "name": "Other Company Inc.", "system_id": "other_company_inc", "uri": "http://localhost:8080/wpm/api/companies/other_company_inc"
}, "internal": true, "system_id": "158872"
}
e) Jonh is replying to public comment by Jane with system_id 158871.
POST /cases/Task-sp-2/comments
Request body:
Reponse body:
f) John is replying to internal comment by Jane with system_id 158872.
POST /cases/Task-sp-2/comments
{ "comment": "Public - John - Reply to Jane's public comment.", "internal": "false", "parent_system_id": "158871"
}
{ "author": { "first_name":
"John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "comment": "Public - John - Reply to Jane's public comment.", "created_on": "11/02/14 11:48:12", "internal": false, "parent_system_id": "158871", "system_id": "158875"
}
135 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
PUT /cases/{system_id}/comments/{comment_system_id}
HTTP Method PUT Path /cases/{system_id}/comments/{comment_system_id} Description Updates a comment based on received CommentBean in case with
specified system id.
Note: Comment visibility cannot be changed. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body CommentBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Comment successfully updated.
403 Forbidden – User does not have permission to edit specified comment. 400 Bad Request – Case does not contain specified comment. 404 Not Found – Case or Comment not found.
Body CommentBean - success. ErrorBean - failure.
JSON example:
a) John wants to update his public comment with system id 158868.
PUT /cases/Task-sp-2/comments/158868
{ "comment": "Internal - John - Reply to Jane's internal comment.", "internal": "false", "parent_system_id": "158872"
}
{ "error_code": "PERMISSION_DENIED", "error_messages": [ "You do not have permission to reply to this comment."
] }
136 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
b) John wants to update Jane’s internal comment with system id 158872.
PUT /cases/Task-sp-2/comments/158872
Request body:
Response body:
{ "comment": "Public - John - UPDATED"
}
{ "author": { "first_name":
"John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "comment": "Public - John - UPDATED", "created_on": "11/02/14 11:48:12", "internal": false, "system_id": "158868", "updated_on": "13/02/14 16:19:37", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }
}
{ "comment": "Internal - Jane - UPDATED"
}
{ "error_code": "PERMISSION_DENIED", "error_messages": [ "You do not have permission to update this comment."
] }
137 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DELETE /cases/{system_id}/comments/{comment_system_id}
HTTP Method DELETE Path /cases/{system_id}/comments/{comment_system_id} Description Deletes a comment with specified comment system id in case with
specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Comment successfully deleted.
400 Bad Request – Case does not contain specified comment. 403 Forbidden – Requester does not have permission to delete the comment. 404 Not Found – Case or comment not found.
Body ErrorBean - failure.
JSON example:
a) John wants to delete public his public comment with system_id 158868.
DELETE /cases/Task-sp-1/comments/158868
b) John wants to delete Jane’s internal comment with system_id 158872.
DELETE /cases/Task-sp-1/comments/158872
{ "error_code": "PERMISSION_DENIED", "error_messages": [ "You do not have permission to delete this comment."
] }
138 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/{system_id}/actions
HTTP Method GET Path /cases/{system_id}/actions Description Returns all actions which user who is performing REST call can execute
in specified case. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case found.
404 Not Found – Case not found. Body List of ActionBean objects - success.
ErrorBean - failure.
JSON example:
Jonh is performing a REST call requesting a list of actions he can execute.
GET /cases/Task-sp-2/actions
Response body:
[ { "name": "Add Comment", "system_id": "3680", "type": "Add Comment"
}, { "name": "Assign", "system_id": "1886", "type": "Assign"
}, { "name": "Change Status to Awaiting Clarification", "system_id": "922", "type": "Assign"
}, { "name": "Task Complete", "system_id": "1299", "type": "Assign"
}, { "name": "Attach File", "system_id": "388", "type": "Attach File"
}, {
139 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"name": "Change Workflow", "system_id": "1513", "type": "Change Workflow"
}, { "name": "Change Project", "system_id": "1629", "type": "Change Project"
}, { "name": "Close", "system_id": "390", "type": "Close"
}, { "name": "Delete Attachment", "system_id": "4840", "type": "Delete Attachment"
}, { "name": "Delete Case", "system_id": "1648", "type": "Delete Case"
}, { "name": "Delete Comment", "system_id": "5089", "type": "Delete Comment"
}, { "name": "Edit Case", "system_id": "1142", "type": "Edit Case"
}, { "name": "Print Document", "system_id": "3827", "type": "Print Document"
}, { "name": "Send Message", "system_id": "1414", "type": "Send Message"
}, { "name": "Share Case", "system_id": "3621", "type": "Share Case"
}, { "name": "View Case", "system_id": "1916", "type": "View Case"
} ]
140 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /cases/{system_id}/actions/{user_system_id}
HTTP Method GET Path /cases/{system_id}/actions/{user_system_id} Description Returns all actions which specified user can execute in specified case. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case found.
404 Not Found – Case or user not found. Body List of ActionBean objects - success.
ErrorBean - failure.
JSON example:
Jonh is performing a REST call requesting a list of actions Tom Smith can execute.
GET /cases/Task-sp-2/actions/tsmith
Response body:
[ { "name": "Add Comment", "system_id": "3680", "type": "Add Comment"
}, { "name": "Assign", "system_id": "1886", "type": "Assign"
}, { "name": "Change Status to Awaiting Clarification", "system_id": "922", "type": "Assign"
}, { "name": "Task Complete", "system_id": "1299", "type": "Assign"
}, { "name": "Attach File", "system_id": "388", "type": "Attach File"
}, { "name": "Delete Attachment", "system_id": "4840",
141 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"type": "Delete Attachment" }, { "name": "Delete Comment", "system_id": "5089", "type": "Delete Comment"
}, { "name": "Edit Case", "system_id": "1142", "type": "Edit Case"
}, { "name": "Print Document", "system_id": "3827", "type": "Print Document"
}, { "name": "Send Message", "system_id": "1414", "type": "Send Message"
}, { "name": "Share Case", "system_id": "3621", "type": "Share Case"
}, { "name": "View Case", "system_id": "1916", "type": "View Case"
} ]
142 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /cases/{system_id}/actions/{action_system_id}
HTTP Method PUT Path /cases/{system_id}/actions/{action_system_id} Description Executes specified action in specified case.
Case is updated based on received ActionParamsBean.
Supported actions: 1. Assign 2. Add Comment 3. Change Status 4. Close Case 5. Edit Case 6. Delete Case 7. Reopen Case 8. Copy Case 9. Change Case Type 10. Change Project 11. Approve 12. Reject 13. Scripting Action
(Attach file action has its own method.)
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body ActionParamsBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Action successfully executed (except delete case action).
204 No Content – Delete case action executed successfully. 400 Bad Request – Required custom fields are not sent. 403 Forbidden – User does not have permission to to execute action. 404 Not Found – Case or Action not found; child entity with system_id sent via ActionParamsBean does not exist.
Body CaseBean – success (except delete). empty – When delete case action is exeuted successfully. ErrorBean - failure.
143 Workflow API © 2018 SAP, Inc. All Rights Reserved.
JSON example:
Note: All REST API calls for executing actions will be made by John Smith (jsmith). Case updater after executing actions will be Jonh Smith. Examples show what ActionParamsBean fields are used for each action.
1) Assign
PUT /cases/Task-sp-2/actions/my_assign_action
Request body:
Response body:
{ "comment": "Execute assign action via REST API", "comment_is_internal": true, "assignees": [ {
"system_id": "jsmith" }, {
"system_id": "tsmith" }
], "custom_fields": [ {
"system_id": "effort_left", "value": "2"
}, {
"system_id": "duration", "value": "15"
} ]
}
{ "account": { "name": "Some Company Account", "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account"
}, "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith",
144 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }
], "case_key": "Task-sp-2", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "contact": { "email": "[email protected]", "first_name": "John", "last_name": "Smith", "middle_name": "", "system_id": "[email protected]", "uri": "http://localhost:8080/wpm/api/contacts/[email protected]"
}, "created_on": "10/09/2013 14:36:44", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "2", "value_formatted": "2"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "This case is created via RESTful web services.", "name": "Task 2 - Created via REST", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "priority": { "name": "High",
145 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "Critical" }, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "referral": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "status": { "name": "Described", "system_id": "described"
}, "status_changed_on": "10/15/2013 15:35:19", "system_id": "Task-sp-2", "updated_on": "10/15/2013 15:59:53", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
2) Add Comment
a) Public comment
PUT /cases/Task-sp-2/actions/my_add_comment
Request body:
{ "comment": "Execute add comment action via REST - public comment", "comment_is_internal": false, "custom_fields": [ {
"system_id": "effort_left", "value": "1"
}, {
"system_id": "duration", "value": "15"
} ]
}
146 Workflow API © 2018 SAP, Inc. All Rights Reserved.
b) Internal comment
PUT /cases/Task-sp-2/actions/my_add_comment
Request body:
3) Change Status
Note: Case goes into action’s end status.
PUT /cases/Task-sp-2/actions/change_status_to_awaiting_clarification
Request body:
4) Close Case
Note: Case assignee it the first assignee from assignees list in receiverd ActionParamsBean. PUT /cases/Task-sp-2/actions/my_close_case_action
{ "comment": "Execute add comment action via REST - internal comment", "comment_is_internal": true, "custom_fields": [ {
"system_id": "effort_left", "value": "1"
}, {
"system_id": "duration", "value": "15"
} ]
}
{ "custom_fields": [ {
"system_id": "effort_left", "value": "14"
}, {
"system_id": "duration", "value": "15"
} ]
}
147 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request body:
5) Edit Case
PUT /cases/Task-sp-2/actions/my_edit_case
Request body:
Response body:
{ "comment": "Execute close case action via REST - public comment", "comment_is_internal": false, "assignees": [ {
"system_id": "tsmith" }
], "custom_fields": [ {
"system_id": "effort_left", "value": "0"
}, {
"system_id": "duration", "value": "15"
} ]
}
{ "name": "Task 2 updated via Edit action", "description": "Updating description via Edit action", "priority_system_id": "Critical", "account_system_id": "some_company_account", "contact_system_id": "jsmith_someaddress_com", "owner_system_id": "jsmith", "referral_system_id": "tsmith", "custom_fields": [ {
"system_id": "effort_left", "value": "2"
}, {
"system_id": "duration", "value": "15"
} ]
}
{ "account": { "name": "Some Company Account", "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account"
}, "assignees": [ {
148 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }
], "case_key": "Task-sp-2", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "contact": { "email": "[email protected]", "first_name": "John", "last_name": "Smith", "middle_name": "", "system_id": "jsmith_someaddress_com", "uri": "http://localhost:8080/wpm/api/contacts/jsmith_someaddress_com"
}, "created_on": "09/10/13 14:36:44", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "2", "value_formatted": "2"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "Updating description via Edit action", "name": "Task 2 updated via Edit action",
149 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "priority": { "name": "High", "system_id": "Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "referral": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-2", "updated_on": "14/10/13 14:07:15", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
150 Workflow API © 2018 SAP, Inc. All Rights Reserved.
6) Delete Case
Note: Request body must contain empty JSON.
PUT /cases/Task-sp-2/actions/my_delete_action
Request body:
Response:
7) Reopen Case
Note: Case assignee it the first assignee from assignees list in receiverd ActionParamsBean.
PUT /cases/Task-sp-2/actions/my_close_case_action
Request body:
{}
Response body: empty Status: 204 No Content
{ "comment": "Execute reopen case action via REST - internal comment", "comment_is_internal": true, "assignees": [ {
"system_id": "tsmith" }
], "custom_fields": [ {
"system_id": "effort_left", "value": "2"
}, {
"system_id": "duration", "value": "15"
} ]
}
151 Workflow API © 2018 SAP, Inc. All Rights Reserved.
8) Copy Case
Note: Reponse contains new case (new copy). Custom Fields are updated in both cases (original and copy).
PUT /cases/Task-sp-2/actions/my_copy_case
Request body:
Response body:
{ "custom_fields": [ {
"system_id": "effort_left", "value": "5"
}, {
"system_id": "duration", "value": "15"
} ]
}
{ "account": { "name": "Some Company Account", "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account"
}, "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-10", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "contact": { "email": "[email protected]", "first_name": "John", "last_name": "Smith", "middle_name": "", "system_id": "[email protected]", "uri": "http://localhost:8080/wpm/api/contacts/[email protected]"
}, "created_on": "15/10/13 14:27:54", "creator": {
152 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "5", "value_formatted": "5"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "Updating description via Edit action", "name": "Task 2 updated via Edit action", "priority": { "name": "High", "system_id": "Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-sp-10", "updated_on": "15/10/13 14:27:54", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-10"
}
153 Workflow API © 2018 SAP, Inc. All Rights Reserved.
9) Change Case Type
PUT /cases/Task-sp-10/actions/my_change_case_type_action
Request body:
Response body:
{ "case_type_system_id": "Bug", "custom_fields": [ {
"system_id": "effort_left", "value": "10"
}, {
"system_id": "duration", "value": "15"
} ]
}
{ "account": { "name": "Some Company Account", "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account"
}, "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Bug-sp-1", "case_type": { "name": "Bug", "system_id": "bug", "unique_key": "bug"
}, "closed": false, "contact": { "email": "[email protected]", "first_name": "John", "last_name": "Smith", "middle_name": "", "system_id": "[email protected]", "uri": "http://localhost:8080/wpm/api/contacts/[email protected]"
}, "created_on": "15/10/13 14:27:54", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith",
154 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "10", "value_formatted": "10"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "Updating description via Edit action", "name": "Task 2 updated via Edit action", "priority": { "name": "High", "system_id": "Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Bug-sp-1", "updated_on": "15/10/13 14:42:29", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "uri": "http://localhost:8080/wpm/api/cases/Bug-sp-1"
}
155 Workflow API © 2018 SAP, Inc. All Rights Reserved.
10) Change Project
PUT /cases/Task-sp-9/actions/my_change_project_action
Request body:
Response body:
{ "project_system_id": "ap", "custom_fields": [ {
"system_id": "effort_left", "value": "1"
}, {
"system_id": "duration", "value": "15"
} ]
}
{ "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }
], "case_key": "Task-ap-1", "case_type": {
"name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "created_on": "10/10/13 16:02:37", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith",
156 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"user_type": { "name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
}, {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "1", "value_formatted": "1"
} ], "description": "This case is created via REST API.", "name": "REST API - Case 4", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "priority": { "name": "Medium", "system_id": "Non-Critical"
}, "project": { "description": "", "is_default": false, "name": "Another Project", "system_id": "ap", "uri": "http://localhost:8080/wpm/api/projects/ap"
}, "status": { "name": "Described", "system_id": "described"
}, "system_id": "Task-ap-1", "updated_on": "15/10/13 15:06:14", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-ap-1"
}
157 Workflow API © 2018 SAP, Inc. All Rights Reserved.
11) Approve
Case “Task-sp-2” is in status “Awaiting Clarification”. Approve action sends case to “Task Complete” status.
PUT /cases/Task-sp-2/actions/my_approve_action
Request body:
Response body:
{ "custom_fields": [ {
"system_id": "effort_left", "value": "0"
}, {
"system_id": "duration", "value": "15"
} ]
}
{ "account": { "name": "Some Company Account", "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account"
}, "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-2", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "contact": { "email": "[email protected]", "first_name": "John", "last_name": "Smith", "middle_name": "", "system_id": "[email protected]", "uri": "http://localhost:8080/wpm/api/contacts/[email protected]"
}, "created_on": "09/10/13 14:36:44", "creator": {
158 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "0", "value_formatted": "0"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "Updating description via Edit action", "name": "Task 2 updated via Edit action", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "priority": { "name": "High", "system_id": "Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "referral": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "status": { "name": "Task Complete", "system_id": "task_complete"
}, "status_changed_on": "15/10/13 15:33:15", "system_id": "Task-sp-2",
159 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"updated_on": "15/10/13 15:33:15", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
12) Reject
Case “Task-sp-2” is in status “Awaiting Clarification”. Reject action sends case to “Described” status.
PUT /cases/Task-sp-2/actions/my_reject_action
Request body:
Response body:
{ "custom_fields": [ {
"system_id": "effort_left", "value": "5"
}, {
"system_id": "duration", "value": "15"
} ]
}
{ "account": { "name": "Some Company Account", "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account"
}, "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-2", "case_type": { "name": "Task", "system_id": "task",
160 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"unique_key": "task" }, "closed": false, "contact": { "email": "[email protected]", "first_name": "John", "last_name": "Smith", "middle_name": "", "system_id": "[email protected]", "uri": "http://localhost:8080/wpm/api/contacts/[email protected]"
}, "created_on": "09/10/13 14:36:44", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "5", "value_formatted": "5"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "Updating description via Edit action", "name": "Task 2 updated via Edit action", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "priority": { "name": "High", "system_id": "Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "referral": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith",
161 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "status": { "name": "Described", "system_id": "described"
}, "status_changed_on": "15/10/13 15:35:19", "system_id": "Task-sp-2", "updated_on": "15/10/13 15:35:19", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
13) Scripting Action
Scripting action with system id “my_scripting_action” has Workflow script attached to itself. The sctipt is written in Groovy and changes case name to specific text.
Script code:
PUT /cases/Task-sp-2/actions/my_scripting_action
Request body
currentCase.setName("new name set by executing scripting action via REST");
{ "custom_fields": [ {
"system_id": "effort_left", "value": "4"
}, {
"system_id": "duration", "value": "15"
} ]
}
162 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
{ "account": { "name": "Some Company Account", "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account"
}, "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }
], "case_key": "Task-sp-2", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "contact": { "email": "[email protected]", "first_name": "John", "last_name": "Smith", "middle_name": "", "system_id": "[email protected]", "uri": "http://localhost:8080/wpm/api/contacts/[email protected]"
}, "created_on": "09/10/13 14:36:44", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "4", "value_formatted": "4"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
}
163 Workflow API © 2018 SAP, Inc. All Rights Reserved.
], "description": "Updating description via Edit action", "name": "new name set by executing scripting action via REST", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "priority": { "name": "High", "system_id": "Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "referral": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "status": { "name": "Described", "system_id": "described"
}, "status_changed_on": "15/10/13 15:35:19", "system_id": "Task-sp-2", "updated_on": "15/10/13 15:42:06", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
164 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /cases/{system_id}/actions/{action_system_id}/{user_system_id}
HTTP Method PUT Path /cases/{system_id}/actions/{action_system_id}/{user_system_id} Description Executes specified action in specified case as specified user. (Attach
file action has its own method.) Case is updated based on received ActionParamsBean.
Supported actions:
1. Assign 2. Add Comment 3. Change Status 4. Close Case 5. Edit Case 6. Delete Case 7. Reopen Case 8. Copy Case 9. Change Case Type 10. Change Project 11. Approve 12. Reject 13. Scripting Action
(Attach file action has its own method.)
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body ActionParamsBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Action successfully executed (except delete case action).
204 No Content – Delete case action executed successfully. 400 Bad Request – Required custom fields are not sent. 403 Forbidden – User does not have permission to to execute action. 404 Not Found – Case, Action or User not found; child entity with system_id sent via ActionParamsBean does not exist.
Body CaseBean – success (except delete). empty – When delete case action is exeuted successfully. ErrorBean - failure.
165 Workflow API © 2018 SAP, Inc. All Rights Reserved.
JSON example:
Note: All REST API calls for executing actions will be made by John Smith (jsmith). Case updater after executing actions will be user with system_id “user_system_id”. Assign Action example:
PUT /cases/Task-sp-2/actions/my_assign_action/tsmith
Request body:
Response body:
{ "comment": "Execute assign action via REST API", "comment_is_internal": true, "assignees": [ {
"system_id": "jsmith" }, {
"system_id": "tsmith" }
], "custom_fields": [ {
"system_id": "effort_left", "value": "6"
}, {
"system_id": "duration", "value": "15"
} ]
}
{ "account": { "name": "Some Company Account", "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account"
}, "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith",
166 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }
], "case_key": "Task-sp-2", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "contact": { "email": "[email protected]", "first_name": "John", "last_name": "Smith", "middle_name": "", "system_id": "[email protected]", "uri": "http://localhost:8080/wpm/api/contacts/[email protected]"
}, "created_on": "10/09/2013 14:36:44", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "6", "value_formatted": "6"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "This case is created via REST API.", "name": "Task 2 – created via REST API", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "priority": { "name": "High", "system_id": "Critical"
},
167 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "referral": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "status": { "name": "Described", "system_id": "described"
}, "status_changed_on": "10/15/2013 15:35:19", "system_id": "Task-sp-2", "updated_on": "10/15/2013 16:32:34", "updater": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
168 Workflow API © 2018 SAP, Inc. All Rights Reserved.
2. POST /cases/{system_id}/actions/{action_system_id}
HTTP Method POST Path /cases/{system_id}/actions/{action_system_id} Description Executes specified Attach File action in specified case.
Request must have the following header: Content-Type: multipart/form-data; boundary= …
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body 1. File with size less than 20MB uploaded as form field with
name “uploaded_file”. 2. Attachment visibility sent as form field with name “internal”.
Values true/false. 3. Comment sent as form field with name “comment”.
Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Action successfully executed.
403 Forbidden – User does not have permission to to execute action. 400 Bad Request – File not sent; file larger than 20MB; 404 Not Found – Case or Action not found.
Body CaseBean – success. ErrorBean - failure.
Example HTML form:
<html> <head> </head> <body>
<form action="http://localhost:8080/wpm/api/cases/Task-sp-2/actions/my_attach_file_action" enctype="multipart/form-data" method="post"> Visibility: <input type="radio" value="false" name="internal">Public <input type="radio" value="true" name="internal">Internal <br /> Comment: <input type="text" name="comment"> <br /> <INPUT type="submit" value="Upload"> <INPUT type="reset">
</form> </body>
</html>
169 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request example:
John Smith is uploading attachment using Attach File Action.
PUT /cases/Task-sp-2/actions/my_assign_action
Response body:
{ "account": { "name": "Some Company Account", "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account"
}, "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }
], "case_key": "Task-sp-2", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false, "contact": { "email": "[email protected]", "first_name": "John", "last_name": "Smith", "middle_name": "", "system_id": "[email protected]", "uri": "http://localhost:8080/wpm/api/contacts/[email protected]"
}, "created_on": "10/09/2013 14:36:44",
170 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "6", "value_formatted": "6"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "Updating description via Edit action", "name": "new name set by executing scripting action via REST", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "priority": { "name": "High", "system_id": "Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "referral": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "status": { "name": "Described", "system_id": "described"
}, "status_changed_on": "10/15/2013 15:35:19",
171 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "Task-sp-2", "updated_on": "10/16/2013 11:40:46", "updater": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
3. POST /cases/{system_id}/actions/{action_system_id}/{user_system_id}
HTTP Method POST Path /cases/{system_id}/actions/{action_system_id}/{user_system_id} Description Executes specified Attach File action in specified case as specified
user.
Request must have the following header: Content-Type: multipart/form-data; boundary= …
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body 1. File with size less than 20MB uploaded as form field with
name “uploaded_file”. 2. Attachment visibility sent as form field with name “internal”.
Values true/false. 3. Comment sent as form field with name “comment”.
Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Action successfully executed.
403 Forbidden – User does not have permission to to execute action. 400 Bad Request – File not sent; file larger than 20MB; 404 Not Found – Case, Action or user not found.
Body CaseBean – success. ErrorBean - failure.
Example HTML form:
<html> <head> </head> <body>
<form action="http://localhost:8080/wpm/api/cases/Task-sp-2/actions/my_attach_file_action/tsmith" enctype="multipart/form-data" method="post"> Visibility: <input type="radio" value="false" name="internal">Public <input type="radio" value="true" name="internal">Internal
172 Workflow API © 2018 SAP, Inc. All Rights Reserved.
<br /> Comment: <input type="text" name="comment"> <br /> <INPUT type="submit" value="Upload"> <INPUT type="reset">
</form> </body>
</html>
Request example:
John Smith is executing REST API call and uploading attachment using Attach File Action. Tom Smith is supposed to be set as action executor.
PUT /cases/Task-sp-2/actions/my_assign_action/tsmith
Response body:
{ "account": { "name": "Some Company Account", "system_id": "some_company_account", "uri": "http://localhost:8080/wpm/api/accounts/some_company_account"
}, "assignees": [ {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Partner", "system_id": "partner"
} }
], "case_key": "Task-sp-2", "case_type": { "name": "Task", "system_id": "task", "unique_key": "task"
}, "closed": false,
173 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"contact": { "email": "[email protected]", "first_name": "John", "last_name": "Smith", "middle_name": "", "system_id": "[email protected]", "uri": "http://localhost:8080/wpm/api/contacts/[email protected]"
}, "created_on": "10/09/2013 14:36:44", "creator": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "custom_fields": [ {
"name": "Effort Left", "system_id": "effort_left", "type_name": "Number", "type_system_id": 2, "value": "6", "value_formatted": "6"
}, {
"name": "Duration", "system_id": "duration", "type_name": "Number", "type_system_id": 2, "value": "15", "value_formatted": "15"
} ], "description": "Updating description via Edit action", "name": "new name set by executing scripting action via REST", "owner": { "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Partner", "system_id": "partner"
} }, "priority": { "name": "High", "system_id": "Critical"
}, "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "referral": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
174 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "status": { "name": "Described", "system_id": "described"
}, "status_changed_on": "10/15/2013 15:35:19", "system_id": "Task-sp-2", "updated_on": "10/16/2013 11:40:46", "updater": { "first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "uri": "http://localhost:8080/wpm/api/cases/Task-sp-2"
}
175 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Case Type
Resource: Case Types Main path: /case_types
GET /case_types/{system_id}
HTTP Method GET Path /case_types/{system_id} Description Returns the case type with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case Type found.
404 Not Found – Case Type not found. Body CaseTypeBean - success.
ErrorBean - failure.
JSON example:
a) GET /case_types/task
Response body:
{ "name": "Task", "system_id": "task", "unique_key": "task"
}
176 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /case_types
HTTP Method GET Path /case_types Description Search case types based on set query parameters. Returns a list of
case types which satisfy search criteria.
Available search attributes: page (Number) page_size (Number) name (String) system_id (String) mask (String)
These search attributes are set as query parameters: /case_types?name=task&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with list of CaseTypeBeans.
JSON example: Response body: GET /case_types?name=task&page=1&page_size=5
{ "case_types": [ {
"name": "Task", "system_id": "task", "unique_key": "task"
} ], "completed_in": 35, "page": 1, "page_size": 10, "total": 1
}
177 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /case_types/{system_id}/statuses
HTTP Method GET Path /case_types/{system_id}/statuses Description Returns statuses associated with specified case type. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case Type found.
404 Not Found – Case Type not found. Body List of StatusBeans - success.
ErrorBean - failure.
JSON example:
GET /case_types/task/statuses
Response body:
[ { "name": "Described", "system_id": "described"
}, { "name": "In Preparation", "system_id": "in_preparation"
}, { "name": "Awaiting Clarification", "system_id": "awaiting_clarification"
}, { "name": "Task Complete", "system_id": "task_complete"
}, { "name": "Closed", "system_id": "closed"
} ]
178 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /case_types/{system_id}/statuses/{status_system_id}/actions
HTTP Method GET Path /case_types/{system_id}/statuses/{status_system_id}/actions Description Returns actions in specified status for specified case type. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Case Type found.
404 Not Found – Case Type or Status not found. Body List of ActionBeans - success.
ErrorBean - failure.
JSON example:
GET /case_types/task/statuses/awaiting_clarification/action
Response body:
[ { "end_status": {
"name": "Awaiting Clarification", "system_id": "awaiting_clarification"
}, "name": "Add Comment", "start_status": {
"name": "Awaiting Clarification", "system_id": "awaiting_clarification"
}, "system_id": "add_comment", "type": "Add Comment"
}, { "end_status": {
"name": "Task Complete", "system_id": "task_complete"
}, "name": "Task Completed", "start_status": {
"name": "Awaiting Clarification", "system_id": "awaiting_clarification"
}, "system_id": "task_complete", "type": "Assign"
} ]
179 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Company
Resource: Company Main path: /companies
GET /companies/{system_id}
HTTP Method GET Path /companies/{system_id} Description Returns the company with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Company found.
404 Not Found – Company not found. Body CompanyBean - success.
ErrorBean - failure.
JSON example:
a) GET /companies/my_company_inc
Response body:
{ "address_1": "Some Street 123", "address_2": "", "city": "San Francisco", "country": "USA", "name": "My Company Inc.", "project": { "description": "This is a project for grouping cases regarding sales.", "is_default": false, "name": "Sales project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "state": "California", "system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/my_company_inc", "zip": "12345"
}
180 Workflow API © 2018 SAP, Inc. All Rights Reserved.
b) GET /companies/some_non_existing_company
POST /companies
HTTP Method POST Path /companies Description Creates a company based on received CompanyBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CompanyBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Company successfully created.
400 Bad Request – Required fields are missing or other constraint error.
Body CompanyBean - success. ErrorBean - failure.
JSON example:
a) POST /companies
Request body:
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Company does not exist."
] }
{ "address_1": "Some Street 123", "address_2": "", "city": "San Francisco", "country": "USA", "name": "My Company Inc.", "project_system_id": "sp", "state": "California", "system_id": "my_company_inc", "zip": "12345"
}
181 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"error_code": "CONSTRAINT_VIOLATIONS", "error_messages": [ "Company name is required."
] }
PUT /companies
HTTP Method PUT Path /companies Description Updates the company based on received CompanyBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body CompanyBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Company successfully updated.
400 Bad Request – Required fields are missing or other constraint error. 404 Not Found – Company not found.
Body CompanyBean - success. ErrorBean - failure.
JSON example:
Note: CompanyBean‘s “system_id” field must be set.
PUT /companies
Request body:
{ "address_1": "Some Street 456", "address_2": "Oak Street 789", "city": "San Francisco", "country": "USA", "name": "My Company Inc.", "project_system_id": "sp", "state": "California", "system_id": "my_company_inc", "zip": "12345"
}
182 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
DELETE /companies/{system_id}
HTTP Method DELETE Path /companies/{system_id} Description Deletes the company with specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Company successfully deleted.
304 Not Modified – If company could not be deleted. 404 Not Found – Company not found.
Body ErrorBean - failure.
Request example: DELETE /companies/my_company_inc
{ "address_1": "Some Street 456", "address_2": "Oak Street 789", "city": "San Francisco", "country": "USA", "name": "My Company Inc.", "project": { "description": "", "is_default": false, "name": "Sales Project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "state": "California", "system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/my_company_inc", "zip": "12345"
}
183 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /companies
HTTP Method GET Path /companies Description Search companies based on set query parameters. Returns a list of
companies which satisfy search criteria.
Available search attributes: page (Number) page_size (Number) name (String) system_id (String) mask (String)
These search attributes are set as query parameters: /companies?name=inc&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with list of CompanyBeans.
JSON example:
GET /companies?name=inc&page=1&page_size=5
{ "companies": [ {
"address_1": "Some Street 123", "address_2": "", "city": "San Francisco", "country": "USA", "name": "My Company Inc.", "project": { "description": "This is a project for grouping cases regarding sales.", "is_default": false, "name": "Sales project", "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}, "state": "California", "system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/my_company_inc", "zip": "12345"
}, {
184 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"address_1": "Fake Street 567", "address_2": "", "city": "New York", "country": "USA", "name": "Other company Inc.", "state": "New York", "system_id": "other_company_inc", "uri": "http://localhost:8080/wpm/api/companies/other_company_inc", "zip": "45678"
},
], "completed_in": 68, "page": 1, "page_size": 5, "total": 1
}
185 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Contact
Resource: Contact Main path: /contacts
GET /contacts/{system_id}
HTTP Method GET Path /contacts/{system_id} Description Returns the contact with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Contact found.
404 Not Found – Contact not found. Body ContactBean - success.
ErrorBean - failure.
JSON example:
a) GET /contacts/jsmith_someaddress_com
Response body:
{ "account": { "name": "Account B", "system_id": "account_b", "uri": "http://localhost:8080/wpm/api/accounts/account_b"
}, "active": true, "address": { "address2": "Second Street 456", "address3": "Third Street 789", "city": "San Francisco", "country": {
"name": "USA", "system_id": "usa"
}, "state": {
"name": "California", "system_id": "CA"
}, "street": "First Street 123", "zip": "12345"
}, "cell_phone": "555-555-456", "custom_fields": [ {
"name": "Contact Role",
186 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "contact_role", "type_name": "Checkbox", "type_system_id": 8, "value": "Consultant", "value_formatted": "Consultant"
} ], "department": "", "email": "[email protected]", "fax": "555-555-741", "first_name": "John", "home_phone": "555-555-789", "id": 1894, "job_title": "Developer", "last_name": "Smith", "middle_name": "", "name": "John Smith", "phone": "555-555-123", "system_id": "jsmith_someaddress_com", "uri": "http://localhost:8080/wpm/api/contacts/jsmith_someaddress_com"
}
b) GET /contacts/some_non_existing_contact
POST /contacts
HTTP Method POST Path /contacts Description Creates a contact based on received ContactBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body ContactBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Contact successfully created.
400 Bad Request – Required fields are missing or other constraint error.
Body ContactBean - success. ErrorBean - failure.
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Contact does not exist."
] }
187 Workflow API © 2018 SAP, Inc. All Rights Reserved.
JSON example:
a) POST /contacts
Request body:
Reponse body:
b) If contact name which is required is not sent:
{ "account_system_id": "account_b", "active": true, "cell_phone": "555-555-111", "custom_fields": [ {
"systemId": "contact_role", "value": "consultant"
} ], "department": "", "email": "[email protected]", "first_name": "John", "home_phone": "555-555-987", "job_title": "Developer", "last_name": "Smith", "system_id": "[email protected]", "phone": "866.612.7312"
}
{ "account": {
"name": "Account B", "system_id": "account_b", "uri": "http://localhost:8080/wpm/api/accounts/account_b"
}, "active": true, "cell_phone": "555-555-111", "department": "", "email": "[email protected]", "first_name": "John", "home_phone": "555-555-987", "job_title": "Developer", "last_name": "Smith", "name": "John Smith", "phone": "866.612.7312", "system_id": "jsmith_someaddress_com", "uri": "http://localhost:8080/wpm/api/contacts/jsmith_someaddress_com"
}
{ "error_code": "CONSTRAINT_VIOLATIONS", "error_messages": [ "Contact name is required."
] }
188 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /contacts
HTTP Method PUT Path /contacts Description Updates the contact based on received ContactBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body ContactBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Contact successfully updated.
400 Bad Request – Required fields are missing or other constraint error. 404 Not Found – Contact not found.
Body ContactBean - success. ErrorBean - failure.
JSON example:
Note: ContactBean’s “system_id” field must be set.
PUT /contacts
Request body:
{ "account_system_id": "account_b", "active": true, "cell_phone": "555-555-222", "custom_fields": [ {
"systemId": "contact_role", "value": "consultant"
} ], "department": "", "email": "[email protected]", "first_name": "John", "home_phone": "555-555-999", "job_title": "Developer", "last_name": "Smith", "system_id": "jsmith_someaddress_com", "phone": "555-555-111"
}
189 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
DELETE /contacts/{system_id}
HTTP Method DELETE Path /contacts/{system_id} Description Deletes the contact with specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Contact successfully deleted.
304 Not Modified – If contact could not be deleted. 404 Not Found – Contact not found.
Body ErrorBean - failure.
Request example: DELETE /contacts/jsmith_someaddress_com
{ "account": {
"name": "Account B", "system_id": "account_b", "uri": "http://localhost:8080/wpm/api/accounts/account_b"
}, "active": true, "cell_phone": "555-555-222", "department": "", "email": "[email protected]", "first_name": "John", "home_phone": "555-555-999", "job_title": "Developer", "last_name": "Smith", "name": "John Smith", "phone": "555-555-111", "system_id": "jsmith_someaddress_com", "uri": "http://localhost:8080/wpm/api/contacts/jsmith_someaddress_com"
}
190 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /contacts
HTTP Method GET Path /contacts Description Search contacts based on set query parameters. Returns a list of
contacts which satisfy search criteria.
Available search attributes: page (Number) page_size (Number) system_id (String) name (String) first_name (String) last_name (String) email (String) account (String) (account’s name) mask (String)
These search attributes are set as query parameters: /contacts?first_name=john&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with a list of ContactBeans.
JSON example:
GET /contacts?first_name=john&last_name=smith&account=account b&page=1&page_size=5
Response body:
{ "completed_in": 134, "contacts": [ {
"account": { "name": "Account B", "system_id": "account_b", "uri": "http://localhost:8080/wpm/api/accounts/account_b"
}, "active": true, "address": { "address2": "Second Street 456", "address3": "Third Street 789",
191 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"city": "San Francisco", "country": { "name": "USA", "system_id": "usa"
}, "state": { "name": "California", "system_id": "CA"
}, "street": "First Street 123", "zip": "12345"
}, "cell_phone": "555-555-456", "custom_fields": [ { "name": "Cell Phone", "system_id": "cell_phone", "type_name": "Text", "type_system_id": 1, "value": "555-555-789", "value_formatted": "555-555-789"
} ], "department": "", "email": "[email protected]", "fax": "555-555-741", "first_name": "John", "home_phone": "555-555-789", "job_title": "Developer", "last_name": "Smith", "middle_name": "", "name": "John Smith", "phone": "555-555-123", "system_id": "jsmith_someaddress_com", "uri": "http://localhost:8080/wpm/api/contacts/jsmith_someaddress_com"
} ], "page": 1, "page_size": 5, "total": 1
}
GET /contacts/{system_id}/custom_fields/{custom_field_system_id}
HTTP Method GET Path /contacts/{system_id}/custom_fields/{custom_field_system_id} Description Returns specified custom field with its value which is set for specified
contact. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A
192 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Field found.
404 Not Found – Contact or Custom Field not found. Body CustomFieldBean - success.
ErrorBean - failure.
JSON example:
GET /contacts/jsmith_someaddress_com/custom_fields/contact_role
Response body:
POST /contacts/{system_id}/custom_fields
HTTP Method POST Path /contacts/{system_id}/custom_fields Description Sets custom field value to specified contact based on received
CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – CustomField value set successfully.
400 Bad Request – Custom Field value is not in the right format. 404 Not Found – Contact or Custom Field not found
Body ContactBean - success. ErrorBean - failure.
JSON example:
POST /contacts/jsmith_someaddress_com/custom_fields
{ "name": "Contact Role", "system_id": "contact_role", "type_name": "Checkbox", "type_system_id": 8, "value": "Consultant", "value_formatted": "Consultant"
}
193 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request body:
PUT /contacts/{system_id}/custom_fields
HTTP Method PUT Path /contacts/{system_id}/custom_fields Description Updates custom field value in specified contact based on received
CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 200 OK – CustomField value set successfully.
400 Bad Request – Custom Field value is not in the right format. 404 Not Found – Contact or Custom Field not found
Body ContactBean - success. ErrorBean - failure.
JSON example:
PUT /contact/jsmith_someaddress_com/custom_fields
Request body:
{ "system_id": "contact_role", "value": "consultant"
}
{ "system_id": "contact_role", "value": "business_analyst"
}
194 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DELETE /contacts/{system_id}/custom_fields/{custom_field_system_id}
HTTP Method DELETE Path /contacts/{system_id}/custom_fields/{custom_field_system_id} Description Deletes the value of specified custom field for specified contact. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom field value successfully deleted.
404 Not Found – Contact or Custom Field not found. Body ErrorBean - failure.
Request example:
DELETE /contacts/jsmith_someaddress_com/custom_fields/contact_role
195 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Custom Field
Resource: Custom Field Main path: /custom_fields
GET /custom_fields/{system_id}
HTTP Method GET Path /custom_fields/{system_id} Description Returns the custom field with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Field found.
404 Not Found – Custom Field not found. Body CustomFieldBean - success.
ErrorBean - failure.
JSON example:
a) GET /custom_fields/product_category
Response body:
{ "label": "Product Category", "name": "Product Category", "predefined_values": [ {
"disabled": false, "label": "First Category", "position": 0, "preselected": false, "system_id": "first"
}, {
"disabled": false, "label": "Second Category", "position": 1, "preselected": false, "system_id": "second"
}, {
"disabled": false, "label": "Third Category", "position": 2, "preselected": false, "system_id": "third"
} ],
196 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "product_category", "type_name": "Checkbox", "type_system_id": 8, "uri": "http://localhost:8080/wpm/api/custom_fields/product_category"
}
b) GET /custom_fields/some_non_existing_custom_field
POST /custom_fields
HTTP Method POST Path /custom_fields Description Creates a custom field based on received CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Custom Field successfully created.
400 Bad Request – Required fields are missing or other constraint error.
Body CustomFieldBean - success. ErrorBean - failure.
JSON example:
a) POST /custom_fields
Request body:
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Custom field does not exist."
] }
{ "label": "Product Category", "name": "Product Category", "system_id": "product_category", "type_system_id": 8, "predefined_values": [ {
"disabled": false, "label": "First Category", "position": 0, "preselected": false, "system_id": "first"
},
197 Workflow API © 2018 SAP, Inc. All Rights Reserved.
{ "disabled": false, "label": "Second Category", "position": 1, "preselected": false, "system_id": "second"
}, {
"disabled": false, "label": "Third Category", "position": 2, "preselected": false, "system_id": "third"
} ]
}
Response body:
b) If custom field’s fields which are required are not sent:
{ "label": "Product Category", "name": "Product Category", "predefined_values": [
{ "disabled": false, "label": "First Category", "position": 0, "preselected": false, "system_id": "first"
}, {
"disabled": false, "label": "Second Category", "position": 1, "preselected": false, "system_id": "second"
}, {
"disabled": false, "label": "Third Category", "position": 2, "preselected": false, "system_id": "third"
} ], "system_id": "product_category", "type_name": "Checkbox", "type_system_id": 8, "uri": "http://localhost:8080/wpm/api/custom_fields/product_category"
}
{ "error_code": "CONSTRAINT_VIOLATIONS", "error_messages": [ "CustomField label is required.", "CustomField field type is required.", "CustomField system id is required.", "CustomField name is required."
] }
198 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /custom_fields
HTTP Method PUT Path /custom_fields Description Updates the custom field based on received CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Field successfully updated.
400 Bad Request – Required fields are missing or other constraint error. 404 Not Found – Custom Field not found.
Body CustomFieldBean - success. ErrorBean - failure.
JSON example: CustomFieldBean’s “system_id” field must be set. Predefined value’s system_id must be set.
PUT /custom_fields
Request body:
{ "label": "Product Category", "name": "Product Category", "system_id": "product_category", "predefined_values": [ {
"disabled": false, "label": "First Category", "position": 0, "preselected": true, "system_id": "first"
}, {
"disabled": true, "label": "Second Category", "position": 1, "preselected": false, "system_id": "second"
}, {
"disabled": false, "label": "Third Category", "position": 2, "preselected": false, "system_id": "third"
} ]
199 Workflow API © 2018 SAP, Inc. All Rights Reserved.
}
Response body:
DELETE /custom_fields/{system_id}
HTTP Method DELETE Path /custom_fields/{system_id} Description Deletes the custom field with specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Field successfully deleted.
304 Not Modified – If Custom Field could not be deleted. 404 Not Found – Custom Field not found.
Body ErrorBean - failure.
Request example: DELETE /custom_fields/product_category
{ "label": "Product Category", "name": "Product Category", "predefined_values": [
{ "disabled": false, "label": "First Category", "position": 0, "preselected": true, "system_id": "first"
}, {
"disabled": true, "label": "Second Category", "position": 1, "preselected": false, "system_id": "second"
}, {
"disabled": false, "label": "Third Category", "position": 2, "preselected": false, "system_id": "third"
} ], "system_id": "product_category", "type_name": "Checkbox", "type_system_id": 8, "uri": "http://localhost:8080/wpm/api/custom_fields/product_category"
}
200 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /custom_fields
HTTP Method GET Path /custom_fields Description Search custom fields based on set query parameters. Returns a list of
custom fields which satisfy search criteria.
Available search attributes: page (Number) page_size (Number) system_id (String) name (String) mask (String)
These search attributes are set as query parameters: /custom_fields?name=product&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with a list of CustomFieldBeans.
JSON example:
GET /custom_fields?name=product&page=1&page_size=5
Response body:
{ "completed_in": 20, "custom_fields": [ {
"label": "Product Category", "name": "Product Category", "predefined_values": [ { "disabled": false, "label": "First Category", "position": 0, "preselected": false, "system_id": "first"
}, { "disabled": false, "label": "Second Category", "position": 1, "preselected": false, "system_id": "second"
201 Workflow API © 2018 SAP, Inc. All Rights Reserved.
}, { "disabled": false, "label": "Third Category", "position": 2, "preselected": false, "system_id": "third"
} ], "system_id": "product_category", "type_name": "Checkbox", "type_system_id": 8, "uri": "http://localhost:8080/wpm/api/custom_fields/product_category"
} ], "page": 1, "page_size": 5, "total": 1
}
202 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Custom Table
Resource: Custom Table Main path: /custom_tables
GET /custom_tables/{system_id}
HTTP Method GET Path /custom_tables/{system_id} Description Returns the custom table with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Table found.
404 Not Found – Custom Table not found. Body CustomTableBean- success.
ErrorBean - failure.
JSON example:
a) GET /custom_tables/territory
Response body:
b) GET /custom_tables/some_non_existing_custom_table
{ "columns": [ "OID", "NAME", "NUMBER_OF_STORES"
], "name": "Territory", "system_id": "territory", "uri": "http://localhost:8080/wpm/api/custom_tables/territory"
}
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Custom Table does not exist."
] }
203 Workflow API © 2018 SAP, Inc. All Rights Reserved.
POST /custom_tables
HTTP Method POST Path /custom_tables Description Creates a custom table based on received CustomTableBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomTableBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Custom Table successfully created.
400 Bad Request – Required fields are missing or other constraint error.
Body CustomTableBean - success. ErrorBean - failure.
JSON example:
a) POST /custom_tables
Request body:
Response body:
{ "name": "Territory", "system_id": "territory", "columns": [ "name", "number_of_stores"
] }
{ "columns": [ "OID", "NAME", "NUMBER_OF_STORES"
], "name": "Territory", "system_id": "territory", "uri": "http://localhost:8080/wpm/api/custom_tables/territory"
}
204 Workflow API © 2018 SAP, Inc. All Rights Reserved.
b) If custom table name which is required is not sent:
DELETE /custom_tables/{system_id}
HTTP Method DELETE Path /custom_tables/{system_id} Description Deletes the custom table with specified system id. Required headers Authorization, domain, Accept Returned headers Status code Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Table successfully deleted.
400 Bad Request – If Custom Table could not be deleted. 404 Not Found – Custom Table not found.
Body ErrorBean - failure.
Request example: DELETE /custom_tables/territory
{ "error_code": "CONSTRAINT_VIOLATIONS", "error_messages": [ "CustomTable name is required."
] }
205 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /custom_tables
HTTP Method GET Path /custom_tables Description Search custom tables based on set query parameters. Returns a list of
custom tables which satisfy search criteria.
Available search attributes: page (Number) page_size (Number) name (String) system_id (String) mask (String)
These search attributes are set as query parameters: /custom_tables?name=territory&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with list of CustomTableBeans.
JSON example:
GET /custom_tables?name=territory&page=1&page_size=5
{ "completed_in": 98, "custom_tables": [ {
"columns": [ "OID", "NAME", "NUMBER_OF_STORES"
], "name": "Territory", "system_id": "territory", "uri": "http://localhost:8080/wpm/api/custom_tables/territory"
} ], "page": 1, "page_size": 5, "total": 1
}
206 Workflow API © 2018 SAP, Inc. All Rights Reserved.
POST /custom_tables/{system_id}/column/{column_name}
HTTP Method POST Path /custom_tables/{system_id}/column/{column_name} Description Adds a column with specified name into specified custom table. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Column successfully added.
400 Bad Request – Column not added. 404 Not Found – Custom Table not found.
Body CustomTableBean - success. ErrorBean - failure.
JSON example:
POST /custom_tables/territory/column/location
Response body:
{ "columns": [ "OID", "NAME", "NUMBER_OF_STORES", "LOCATION"
], "name": "Territory", "system_id": "territory", "uri": "http://localhost:8080/wpm/api/custom_tables/territory"
}
207 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /custom_tables/{system_id}/rows
HTTP Method GET Path /custom_tables/{system_id}/rows Description Returns rows from specified custom table.
Available search attributes: page (Number) page_size (Number)
These search attributes are set as query parameters: /custom_tables/territory/rows? page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Table found.
400 Bad Request - Getting rows failed - Error in operations with custom table. 404 Not Found – Custom Table not found.
Body ResultBean with CustomTableBean object which contains rows - success. ErrorBean - failure.
JSON example:
a) GET /custom_tables/territory/rows
Response body:
{ "completed_in": 249, "custom_table": { "rows": [
{ "cells": [ {
"name": "OID", "value": "1"
}, {
"name": "NAME", "value": "USA"
}, {
"name": "NUMBER_OF_STORES", "value": "60"
208 Workflow API © 2018 SAP, Inc. All Rights Reserved.
}, {
"name": "LOCATION", "value": "USA"
} ], "oid": "1"
}, { "cells": [ {
"name": "OID", "value": "2"
}, {
"name": "NAME", "value": "Europe 1"
}, {
"name": "NUMBER_OF_STORES", "value": "20"
}, {
"name": "LOCATION", "value": "Western Europe"
} ], "oid": "2"
} ]
}, "page": 1, "page_size": 5, "total": 2
}
GET /custom_tables/{system_id}/rows/{oid}
HTTP Method GET Path /custom_tables/{system_id}/rows/{oid} Description Returns row with specified oid (object id) from specified custom table. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Row found.
400 Bad Request – Getting row failed - Error in operations with custom table. 404 Not Found – Custom Table or Row not found.
Body ResultBean with CustomTableBean object which contains rows - success. ErrorBean - failure.
209 Workflow API © 2018 SAP, Inc. All Rights Reserved.
a) GET /custom_tables/territory/rows/2
Response body:
POST /custom_tables/{system_id}/rows
HTTP Method POST Path /custom_tables/{system_id}/rows Description Adds one row in specified custom table based on received row in
CustomTableBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body CustomTableBean with one row. Response - Output Return MIME Type application/json HTTP Status Code 201 OK – Row successfully added.
400 Bad Request – Creating row failed - Error in operations with custom table. 404 Not Found – Custom Table not found.
Body CustomFieldBean with added row. Other rows are left out. ErrorBean - failure.
{ "rows": [ {
"cells": [ { "name": "OID", "value": "2"
}, { "name": "NAME", "value": "Europe 1"
}, { "name": "NUMBER_OF_STORES", "value": "20"
}, { "name": "LOCATION", "value": "Western Europe"
} ], "oid": "2"
} ]
}
210 Workflow API © 2018 SAP, Inc. All Rights Reserved.
POST /custom_tables/territory/rows
Request body:
Response body:
{ "rows": [ {
"cells": [ { "name": "name", "value": "Africa"
}, { "name": "NUMBER_OF_STORES", "value": "25"
}, { "name": "LOCATION", "value": "Africa"
} ]
} ]
}
{ "rows": [ {
"cells": [ { "name": "OID", "value": "3"
}, { "name": "NAME", "value": "Africa"
}, { "name": "NUMBER_OF_STORES", "value": "25"
}, { "name": "LOCATION", "value": "South Africa"
} ], "oid": "3"
} ]
}
211 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /custom_tables/{system_id}/rows
HTTP Method PUT Path /custom_tables/{system_id}/rows Description Updates the row in specified custom table based on received row in
CustomTableBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body CustomTableBean with one row. Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Row successfully updated.
400 Bad Request – Updating row failed - Error in operations with custom table. 404 Not Found – Custom Table or row not found.
Body CustomFieldBean with updated row. Other rows are left out. ErrorBean - failure.
JSON example:
PUT /custom_tables/territory/rows
Request body:
{ "rows": [ {
"cells": [ { "name": "OID", "value": "3"
}, { "name": "NAME", "value": "Africa"
}, { "name": "NUMBER_OF_STORES", "value": "25"
}, { "name": "LOCATION", "value": "South Africa"
} ]
} ]
}
212 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
DELETE /custom_tables/{system_id}/rows/{oid}
HTTP Method DELETE Path /custom_tables/{system_id}/rows/{oid} Description Deletes the row with specified oid in specified custom table. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Row successfully deleted.
400 Bad Request – Deleting row failed - Error in operations with custom table. 404 Not Found – Custom Table or row not found.
Body ErrorBean - failure.
Request example: DELETE /custom_tables/territory/rows/3
{ "rows": [ {
"cells": [ { "name": "OID", "value": "3"
}, { "name": "NAME", "value": "Africa"
}, { "name": "NUMBER_OF_STORES", "value": "25"
}, { "name": "LOCATION", "value": "South Africa"
} ], "oid": "3"
} ]
}
213 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /custom_tables/query/select
HTTP Method PUT Path /custom_tables/query/select Description Executes select query sent via QueryBean and returns rows from
custom table. Number of returned results can be limited using page (Number) and page_size (Number) search attributes.
These search attributes are set as query parameters: /custom_tables/query/select?page=1&page_size=5
Illegal query words: CREATE, ALTER, DROP, TRUNCATE, COMMENT, RENAME, INSERT, UPDATE, DELETE, MERGE, GRANT, REVOKE, OFFSET, LIMIT.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body QueryBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Select query successfully executed.
400 Bad Request – Select query not executed. Body QueryResultBean - success.
ErrorBean - failure.
Example table:
OID NAME NUMBER_OF_STORES LOCATION 1 Africa 25 Africa 2 Europe 42 Western Europe 3 USA 26 West coast 4 Asia 9 Asia
JSON example:
a) PUT /custom_tables/query/select?page=1&page_size=5
Request body:
{ "query": "select oid,name,number_of_stores from territory where number_of_stores > 25 and number_of_stores < 40"
}
214 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
POST /custom_tables/query/insert
HTTP Method POST Path /custom_tables/query/insert Description Inserts data into custom table based on sent query in QueryBean.
Illegal query words: CREATE, ALTER, DROP, TRUNCATE, COMMENT, RENAME, UPDATE, DELETE, MERGE, GRANT, REVOKE, OFFSET, LIMIT.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body QueryBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Insert query successfully executed.
400 Bad Request – Insert query not executed. Body QueryResultBean with row OID - success.
ErrorBean - failure.
{ "completed_in": 2144, "custom_table": { "rows": [
{ "cells": [ {
"name": "OID", "value": "3"
}, {
"name": "NAME", "value": "USA"
}, {
"name": "NUMBER_OF_STORES", "value": "26"
} ], "oid": "3"
} ]
}, "page": 1, "page_size": 10, "total": 1
}
215 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Example table:
OID NAME NUMBER_OF_STORES LOCATION 1 Africa 25 Africa 2 Europe 42 Western Europe 3 USA 26 West coast 4 Asia 9 Asia
JSON example:
a) POST /custom_tables/query/insert
Request body:
Response body:
Table after inserting row:
OID NAME NUMBER_OF_STORES LOCATION 1 Africa 25 Africa 2 Europe 42 Western Europe 3 USA 26 West coast 4 Asia 9 Asia 5 Europe 2 15 South Europe
{ "query": "insert into territory (name, number_of_stores, location) values ('Europe 2', '15', 'South Europe')"
}
{ "completed_in": 52, "oid": 5
}
216 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /custom_tables/query/update
HTTP Method PUT Path /custom_tables/query/update Description Updates data in custom table based on sent query in QueryBean.
Illegal query words: CREATE, ALTER, DROP, TRUNCATE, COMMENT, RENAME, INSERT, DELETE, MERGE, GRANT, REVOKE, OFFSET, LIMIT.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body QueryBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Update query successfully executed.
400 Bad Request – Update query not executed. Body QueryResultBean - success.
ErrorBean - failure.
Example table:
OID NAME NUMBER_OF_STORES LOCATION 1 Africa 25 Africa 2 Europe 42 Western Europe 3 USA 26 West coast 4 Asia 9 Asia 5 Europe 2 15 South Europe
JSON example:
a) PUT /custom_tables/query/update
Request body:
Response body:
{ "query": "update territory set name = 'Europe 1' where name = 'Europe'"
}
{ "affected_rows_count": 1, "completed_in": 62
}
217 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Table after updating row:
OID NAME NUMBER_OF_STORES LOCATION 1 Africa 25 Africa 2 Europe 1 42 Western Europe 3 USA 26 West coast 4 Asia 9 Asia 5 Europe 2 15 South Europe
PUT /custom_tables/query/delete
HTTP Method PUT Path /custom_tables/query/delete Description Updates data in custom table based on sent query in QueryBean.
Illegal query words: CREATE, ALTER, DROP, TRUNCATE, COMMENT, RENAME, INSERT, UPDATE, MERGE, GRANT, REVOKE, OFFSET, LIMIT.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body QueryBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Delete query successfully executed.
400 Bad Request – Delete query not executed. Body QueryResultBean - success.
ErrorBean - failure.
Example table:
OID NAME NUMBER_OF_STORES LOCATION 1 Africa 25 Africa 2 Europe 1 42 Western Europe 3 USA 26 West coast 4 Asia 9 Asia 5 Europe 2 15 South Europe
JSON example:
a) PUT /custom_tables/query/delete
218 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request body:
Response body:
Table after deleting row:
OID NAME NUMBER_OF_STORES LOCATION 1 Africa 25 Africa 3 USA 26 West coast 4 Asia 9 Asia
POST /custom_tables/import/new_table
HTTP Method POST Path /custom_tables/import/new_table Description Creates a new custom table with rows from uploaded csv file.
Request must have the following header: Content-Type: multipart/form-data; boundary= …
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request – Input Accepts application/json Expected request body 1. Table name sent as form field with name “table_name”.
2. csv file with size less than 20MB uploaded as form field with name “uploaded_file”.
Response - Output Return MIME Type application/json HTTP Status Code 201 OK – New table successfully imported.
400 Bad Request – File or table name not sent; file larger than 20MB; table already exists; file is not csv file import failed.
Body CustomTableBean with import report (without rows) - success ErrorBean - failure.
{ "query": "delete from territory where name like '%Europe%'"
}
{ "affected_rows_count": 2, "completed_in": 56
}
219 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Example csv file content:
Example HTML form:
POST /custom_tables/import/new_table
Response body:
name,number_of_stores,location Europe, 10, Southern Europe USA, 25, West Coast Africa, 5, West Africa
<html> <head> </head> <body>
<form action="http://localhost:8080/wpm/api/custom_tables/import/new_table" enctype="multipart/form-data" method="post"> Table Name: <input type="text" name="table_name" /> File: <input type="file" name="uploaded_file"> <input type="submit" value="Import Table" />
</form> </body>
</html>
{ "columns": [ "OID", "NAME", "NUMBER_OF_STORES", "LOCATION"
], "import_report": "Finished importing custom table territory. Imported (3) rows.", "name": "territory", "system_id": "territory", "uri": "http://localhost:8080/wpm/api/custom_tables/territory"
}
220 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Created table:
OID NAME NUMBER_OF_STORES LOCATION 1 Europe 10 Southern Europe 2 USA 25 West Coast 3 Africa 5 West Africa
POST /custom_tables/{system_id}/import/new_rows
HTTP Method POST Path /custom_tables/{system_id}/import/new_rows Description Inserts new rows in specified custom table from uploaded csv file and
updates existing rows. Rows which are left out from the file are not updated.
Existing rows must have OID value: 1, Europe 1, 12, Southern Europe
New rows have empty OID value followed by comma separator: ,Europe 2, 15, East Europe
Request must have the following header: Content-Type: multipart/form-data; boundary= …
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request – Input Accepts application/json Expected request body 1. Table name sent as form field with name “table_name”.
2. csv file with size less than 20MB uploaded as form field with name “uploaded_file”.
Response - Output Return MIME Type application/json HTTP Status Code 200 OK – New rows successfully inserted.
400 Bad Request – File or table name not sent; file larger than 20MB; table already exists; file is not csv file import failed. 404 Not Found – Custom table not found.
Body CustomTableBean with import report (without rows) - success ErrorBean - failure.
221 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Example csv file content:
Example HTML form:
POST /custom_tables/{system_id}/import/new_rows
Response body:
oid,name,number_of_stores,location 1, Europe 1, 12, Southern Europe 3, Africa, 5, West Africa ,Europe 2, 15, East Europe ,Australia, 12, Australia and New Zealand
<html> <head> </head> <body>
<form action="http://localhost:8080/wpm/api/custom_tables/territory/import/new_rows" enctype="multipart/form-data" method="post"> File: <input type="file" name="uploaded_file"> <input type="submit" value="Import Table" />
</form> </body>
</html>
{ "columns": [ "OID", "NAME", "NUMBER_OF_STORES", "LOCATION"
], "import_report": "Finished updating custom table territory. Updated (5) rows.", "name": "territory", "system_id": "territory", "uri": "http://localhost:8080/wpm/api/custom_tables/territory"
}
222 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Updated table:
OID NAME NUMBER_OF_STORES LOCATION 1 Europe 1 12 Southern Europe 2 USA 25 West Coast 3 Africa 5 West Africa 4 Europe 2 15 East Europe 5 Australia 12 Australia and New
Zealand
PUT /custom_tables/export/query_to_csv
HTTP Method PUT Path /custom_tables/export/query_to_csv Description Exports rows from custom table to CSV file based on received SELECT
query in QueryBean.
If file name is empty it will be set to “exportedRows.csv”.
Returned result can be limited with these parameters: page (Number) page_size(Number)
These parameters are set as query parameters: /custom_tables/export/query_to_csv?page=1&page_size=2000
Maximum number of rows (maximum page_size) in exported file is limited to 100000. If page_size parameter is not received, default page size is 50000.
Illegal query words: CREATE, ALTER, DROP, TRUNCATE, COMMENT, RENAME, INSERT, UPDATE, DELETE, MERGE, GRANT, REVOKE, OFFSET, LIMIT.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/octet-stream Expected request body QueryBean Response - Output Returned MIME Type application/vnd.ms-excel HTTP Status Code 200 OK – CSV file returned successfully.
400 Bad Request – Query not provided; Query failed (Custom table does not exist; Illegal query)
Body CSV file - success. ErrorBean - failure.
223 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Example table myStores:
OID NAME NUMBER_OF_STORES LOCATION 1 Africa 25 Africa 2 Europe 42 Western Europe 3 USA 26 West Coast 4 Asia 9 Asia
JSON example:
PUT /custom_tables/export/query_to_csv
Request headers:
Request body:
Response body – csv file content:
Response headers:
domain: default Authorization: Basic bWFya29tOjkyckw2M0paRDZXUno2QTEwMDBx Accept: application/octet-stream Content-Type: application/json
{ "query": "SELECT NAME,NUMBER_OF_STORES,LOCATION from myStores where CAST(NUMBER_OF_STORES AS INT) > 25", "file_name": "big_market.csv
}
NAME,NUMBER_OF_STORES,LOCATION USA,26,West Coast Europe,42,Western Europe
Content-Disposition: attachment; filename="big_market.csv" Content-Type: application/vnd.ms-excel
224 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Department
Resource: Department Main path: /departments
GET /departments/{system_id}
HTTP Method GET Path /departments/{system_id} Description Returns the department with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Department found.
404 Not Found – Department not found. Body DepartmentBean - success.
ErrorBean - failure.
JSON example:
a) GET /departments/accounting
Response body:
{ "company": { "name": "My Company Inc.", "system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/accounting "
}, "gate_keeper": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": {
"name": "Accountant", "system_id": "accountant"
} }, "name": "Accounting", "system_id": "accounting", "uri": "http://localhost:8080/wpm/api/departments/accounting"
}
225 Workflow API © 2018 SAP, Inc. All Rights Reserved.
b) GET /departments/some_non_existing_department
POST /departments
HTTP Method POST Path /departments Description Creates a department based on received DepartmentBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body DepartmentBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Department successfully created.
400 Bad Request – Required fields are missing or other constraint error.
Body DepartmentBean - success. ErrorBean - failure.
JSON example:
a) POST /departments
Request body:
b) If department name which is required is not sent:
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Department does not exist."
] }
{ "company_system_id": "my_company_inc", "gate_keeper_system_id": "jsmith", "name": "Accounting", "system_id": "accounting"
}
{ "error_code": "CONSTRAINT_VIOLATIONS", "error_messages": [ "Department name is required."
] }
226 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /departments
HTTP Method PUT Path /departments Description Updates the department based on received DepartmentBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body DepartmentBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Department successfully updated.
400 Bad Request – Required fields are missing or other constraint error. 404 Not Found – Department not found.
Body DepartmentBean - success. ErrorBean - failure.
JSON example:
Note: DepartmentBean‘s “system_id” field must be set.
PUT /departments
Request body:
Response body:
{ "company_system_id": "my_company_inc", "gate_keeper_system_id": "tsmith", "name": "Accounting Dep", "system_id": "accounting"
}
{ "company": {
"name": "My Company Inc.", "system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/my_company_inc"
}, "gate_keeper": {
"first_name": "Tom", "last_name": "Smith", "login_name": "tsmith", "system_id": "tsmith", "uri": "http://localhost:8080/wpm/api/users/tsmith", "user_type": {
"name": "Sales and Marketing",
227 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"system_id": "sales_and_marketing" }
}, "name": "Accounting Dep", "system_id": "accounting", "uri": "http://localhost:8080/wpm/api/departments/accounting"
}
DELETE /departments/{system_id}
HTTP Method DELETE Path /departments/{system_id} Description Deletes the department with specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Department successfully deleted.
304 Not Modified – If department could not be deleted. 404 Not Found – Department not found.
Body ErrorBean - failure.
Request example: DELETE /departments/accounting
GET /departments
HTTP Method GET Path /departments Description Search departments based on set query parameters. Returns a list of
departments which satisfy search criteria.
Available search attributes: page (Number) page_size (Number) name (String) system_id (String) mask (String)
These search attributes are set as query parameters: /departments?name=accounting&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input
228 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with list of DepartmentBeans.
JSON example:
GET /departments?name=accounting&page=1&page_size=5
{ "completed_in": 89, "departments": [ {
"company": { "name": "My Company Inc.", "system_id": "my_company_inc", "uri": "http://localhost:8080/wpm/api/companies/my_company_inc"
}, "gate_keeper": {
"first_name": "John", "last_name": "Smith", "login_name": "jsmith2", "system_id": "jsmith2", "uri": "http://localhost:8080/wpm/api/users/jsmith2", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing"
} }, "name": "Accounting", "system_id": "accounting", "uri": "http://localhost:8080/wpm/api/departments/accounting"
}, {
"company": { "name": "Other Company, Inc.", "system_id": "other_company_inc", "uri": "http://localhost:8080/wpm/api/companies/other_company_inc"
}, "name": "Other Company Accounting", "system_id": "other_company_accounting", "uri": "http://localhost:8080/wpm/api/departments/other_company_accounting"
} ], "page": 1, "page_size": 5, "total": 2
}
229 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Message
Resource: Message Main path: /messages
GET /messages/{system_id}
HTTP Method GET Path /messages/{system_id} Description Returns the message with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Message found.
404 Not Found – Message not found. Body MessageBean - success.
ErrorBean - failure.
JSON example:
a) GET /messages/157
Response body:
b) GET /messages/123121436547848
{ "body": "Hello Jonh, We can start the implementation phase on this project. Regards, Tom.", "date": "10/07/2013 10:52:36", "from_address": "[email protected]", "subject": "Next project phase", "system_id": "157", "uri": "http://localhost:8080/wpm/api/messages/157"
}
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Message does not exist."
] }
230 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DELETE /messages/{system_id}
HTTP Method DELETE Path /messages/{system_id} Description Deletes the message with specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Message successfully deleted.
304 Not Modified – If message could not be deleted. 404 Not Found – Message not found.
Body ErrorBean - failure.
Request example: DELETE /messages/157
GET /messages/user/{system_id}/unread
HTTP Method GET Path /messages/user/{system_id}/unread Description Search unread messages for specified user based on set query
parameters. Returns a list of unread messages which satisfy search criteria.
Available search attributes: page (Number) page_size (Number) subject (String) body (String) system_id (String)
These search attributes are set as query parameters: /messages/user/jsmith/unread?subject=project&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json
231 Workflow API © 2018 SAP, Inc. All Rights Reserved.
HTTP Status Code 200 OK – Success. 404 Not Found – User not found.
Body ResultBean with list of MessageBeans - success. ErrorBean - failure.
JSON example:
a) GET /messages/user/jsmith/unread
Response body:
1. GET /messages/user/{system_id}/unread_and_mark_as_read
HTTP Method GET Path /messages/user/{system_id}/unread_and_mark_as_read Description Search unread messages for specified user based on set query
parameters. Returns a list of unread messages which satisfy search criteria and marks returned messages as read.
Available search attributes: page (Number) page_size (Number) subject (String) body (String) system_id (String)
These search attributes are set as query parameters: /messages/user/jsmith/unread_and_mark_as_read?subject=project&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type
{ "completed_in": 55, "messages": [ {
"date": "10/07/2013 10:04:28", "from_address": "[email protected]", "subject": "Next project phase", "system_id": "157", "uri": "http://localhost:8080/wpm/api/messages/157"
}, {
"date": "11/07/2013 11:15:45", "from_address": "[email protected]", "subject": "Available resources for project", "system_id": "158", "uri": "http://localhost:8080/wpm/api/messages/158"
} ], "page": 1, "page_size": 5, "total": 2
}
232 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Success.
404 Not Found – User not found. Body ResultBean with list of MessageBeans - success.
ErrorBean - failure.
JSON example:
a) GET /messages/user/jsmith/unread_and_mark_as_read
Response body:
GET /messages/user/{system_id}/total_unread
HTTP Method GET Path /messages/user/{system_id}/total_unread Description Returns the number of unread messages for specified user. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Count returned.
{ "completed_in": 55, "messages": [ {
"date": "10/07/2013 10:04:28", "from_address": "[email protected]", "subject": "Next project phase", "system_id": "157", "uri": "http://localhost:8080/wpm/api/messages/157"
}, {
"date": "11/07/2013 11:15:45", "from_address": "[email protected]", "subject": "Available resources for project", "system_id": "158", "uri": "http://localhost:8080/wpm/api/messages/158"
} ], "page": 1, "page_size": 5, "total": 2
}
233 Workflow API © 2018 SAP, Inc. All Rights Reserved.
404 Not Found – User not found. Body TotalBean - success.
ErrorBean - failure.
JSON example:
a) GET /messages/user/jsmith/total_unread
Response body:
{ "total": 2
}
234 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Project
Resource: Project Main path: /projects
GET /projects/{system_id}
HTTP Method GET Path /projects/{system_id} Description Returns the project with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Project found.
404 Not Found – Project not found. Body ProjectBean - success.
ErrorBean - failure.
JSON example:
a) GET /projects/abc
Response body:
{ "custom_fields": [ {
"name": "Due Date", "system_id": "due_date", "type_name": "Date", "type_system_id": 3, "value": "10/15/14", "value_formatted": "15/10/14"
} ], "description": "This is a project for grouping cases regarding sales.", "is_default": false, "name": "Sales project", "permissions": [ {
"name": "Sales", "system_id": "sales"
} ], "project_roles": [ {
"name": "Project Leader", "system_id": "project_leader", "user_system_id": "jsmith"
}
235 Workflow API © 2018 SAP, Inc. All Rights Reserved.
], "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}
b) GET /projects/some_non_existing_project
POST /projects
HTTP Method POST Path /projects Description Creates a project based on received ProjectBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body ProjectBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Project successfully created.
400 Bad Request – Required fields are missing or other constraint error.
Body ProjectBean - success. ErrorBean - failure.
JSON example:
a) POST /projects
Request body:
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "Project does not exist."
] }
{ "description": "This is a project for grouping cases regarding sales.", "is_default": false, "name": "Sales project", "custom_fields": [ {
"system_id": "due_date", "value": "10/15/14"
} ], "permissions": [ {
"system_id": "sales" }
236 Workflow API © 2018 SAP, Inc. All Rights Reserved.
], "project_roles": [ {
"system_id": "project_leader", "user_system_id": "jsmith"
} ], "system_id": "sp"
}
b) If project name which is required is not sent:
PUT /projects
HTTP Method PUT Path /projects Description Updates the project based on received ProjectBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body ProjectBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Project successfully updated.
400 Bad Request – Required fields are missing or other constraint error. 404 Not Found – Project not found.
Body ProjectBean - success. ErrorBean - failure.
JSON example:
Note: ProjectBean’s “system_id” field must be set.
PUT /projects
{ "error_code": "CONSTRAINT_VIOLATIONS", "error_messages": [ "Project name is required."
] }
237 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Request body:
Response body:
{ "description": "This is a project for grouping cases regarding sales. - UPDATED DESCRIPTION.", "is_default": false, "name": "Sales project", "custom_fields": [ {
"system_id": "due_date", "value": "11/17/14"
} ], "permissions": [ {
"system_id": "sales" }
], "project_roles": [ {
"system_id": "project_leader", "user_system_id": "jsmith"
} ], "system_id": "sp"
}
{ "custom_fields": [ {
"name": "Due Date", "system_id": "due_date", "type_name": "Date", "type_system_id": 3, "value": "11/17/14", "value_formatted": "17/11/14"
} ], "description": "This is a project for grouping cases regarding sales. - UPDATED DESCRIPTION.", "is_default": false, "name": "Sales project", "permissions": [ {
"name": "Sales", "system_id": "sales"
} ], "project_roles": [ {
"name": "Project Leader", "system_id": "project_leader", "user_system_id": "jsmith"
} ], "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
}
238 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DELETE /projects/{system_id}
HTTP Method DELETE Path /projects/{system_id} Description Deletes the project with specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Project successfully deleted.
304 Not Modified – If project could not be deleted. 404 Not Found – Project not found.
Body ErrorBean - failure.
Request example: DELETE /projects/sp
GET /projects
HTTP Method GET Path /projects Description Search projects based on set query parameters. Returns a list of
projects which satisfy search criteria.
Available search attributes: page (Number) page_size (Number) name (String) system_id (String) mask (String)
These search attributes are set as query parameters: /projects?name=sales project&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json
239 Workflow API © 2018 SAP, Inc. All Rights Reserved.
HTTP Status Code 200 OK Body ResultBean with list of ProjectBeans.
JSON example:
GET /projects?name=sales project&page=1&page_size=5
Response body:
{ "completed_in": 118, "page": 1, "page_size": 10, "projects": [ {
"description": "This is a project for grouping cases regarding sales.", "is_default": false, "name": "Sales project", "permissions": [ { "name": "Sales", "system_id": "sales"
} ], "project_roles": [ { "name": "Project Leader", "system_id": "project_leader", "user_system_id": "jsmith"
} ], "system_id": "sp", "uri": "http://localhost:8080/wpm/api/projects/sp"
} ], "total": 1
}
240 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /projects/{system_id}/custom_fields/{custom_field_system_id}
HTTP Method GET Path /projects/{system_id}/custom_fields/{custom_field_system_id} Description Returns specified custom field with its value which is set for specified
project. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Field found.
404 Not Found – Project or Custom Field not found. Body CustomFieldBean - success.
ErrorBean - failure.
JSON example:
GET /projects/sp/custom_fields/due_date
Response body:
{ "name": "Due Date", "system_id": "due_date", "type_name": "Date", "type_system_id": 3, "value": "10/15/14", "value_formatted": "15/10/14"
}
241 Workflow API © 2018 SAP, Inc. All Rights Reserved.
POST /projects/{system_id}/custom_fields
HTTP Method POST Path /projects/{system_id}/custom_fields Description Sets custom field value to specified project based on received
CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – CustomField value set successfully.
400 Bad Request – Custom Field value is not in the right format. 404 Not Found – Project or Custom Field not found
Body ContactBean - success. ErrorBean - failure.
JSON example:
POST /projects/sp/custom_fields
Request body:
{ "system_id": "due_date", "value": "10/25/14"
}
242 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /projects/{system_id}/custom_fields
HTTP Method PUT Path /projects/{system_id}/custom_fields Description Updates custom field value in specified project based on received
CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 200 OK – CustomField value set successfully.
400 Bad Request – Custom Field value is not in the right format. 404 Not Found – Project or Custom Field not found
Body ContactBean - success. ErrorBean - failure.
JSON example:
PUT /projects/sp/custom_fields
Request body:
{ "system_id": "due_date", "value": "12/26/15"
}
243 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DELETE /projects/{system_id}/custom_fields/{custom_field_system_id}
HTTP Method DELETE Path /projects/{system_id}/custom_fields/{custom_field_system_id} Description Deletes the value of specified custom field for specified contact. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom field value successfully deleted.
404 Not Found – Project or Custom Field not found. Body ErrorBean - failure.
Request example: DELETE /projects/sp/custom_fields/due_date
244 Workflow API © 2018 SAP, Inc. All Rights Reserved.
User
Resource: User Main path: /users
Note: UserBean’s system_id attribute has the same value as login_name. We use system_id to find the user. If there is a need to update user’s login name via REST call then system_id has the value of old login name (in order to find the user) and login_name field has the value of new login name.
GET /users/{system_id}
HTTP Method GET Path /users/{system_id} Description Returns the user with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User found.
404 Not Found – User not found. Body UserBean - success.
ErrorBean - failure.
JSON example:
a) GET /users/jsmith
Response body:
{ "active": true, "administrator": true, "custom_fields": [ {
"name": "Yahoo ID", "system_id": "yahoo_id", "type_name": "Text", "type_system_id": 1, "value": "someYahooId123", "value_formatted": "someYahooId123"
} ], "department": { "name":
"Sales", "system_id": "sales", "uri": "http://localhost:8080/wpm/api/departments/sales"
},
245 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"email": "[email protected]", "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing", "uri": "http://localhost:8080/wpm/api/userTypes/sales_and_marketing"
} }
b) GET /users/some_non_existing_user
POST /users
HTTP Method POST Path /users Description Creates a user based on received UserBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body UserBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – User successfully created.
400 Bad Request – Required fields are missing or other constraint error.
Body UserBean - success. ErrorBean - failure.
JSON example:
a) POST /users
Request body:
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "User does not exist."
] }
{ "active": true, "administrator": true, "custom_fields": [ {
"system_id": "yahoo_id", "value": "someYahooId123"
246 Workflow API © 2018 SAP, Inc. All Rights Reserved.
} ], "department_system_id": "sales", "email": "[email protected]", "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "password": "somePassword567", "user_type_system_id": "sales_and_marketing"
}
Response body:
b) If fields which are required are not sent:
{ "active": true, "administrator": true, "custom_fields": [ {
"name": "Yahoo ID", "system_id": "yahoo_id", "type_name": "Text", "type_system_id": 1, "value": "someYahooId123", "value_formatted": "someYahooId123"
} ], "department": { "name":
"Sales", "system_id": "sales", "uri": "http://localhost:8080/wpm/api/departments/sales"
}, "email": "[email protected]", "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing", "uri": "http://localhost:8080/wpm/api/userTypes/sales_and_marketing"
} }
{ "error_code": "CONSTRAINT_VIOLATIONS", "error_messages": [ "User login name is required.", "User department is required.", "User user type is required.", "User last name is required.", "User first name is required.", "User email is required."
] }
247 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /users
HTTP Method PUT Path /users Description Updates the user based on received UserBean.
Note: UserBean’s system_id attribute has the same value as login_name. We use system_id to find the user. If there is a need to update user’s login name via REST call then system_id has the value of old login name (in order to find the user) and login_name field has the value of new login name.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body UserBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User successfully updated.
400 Bad Request – Required fields are missing or other constraint error. 404 Not Found – User not found.
Body UserBean - success. ErrorBean - failure.
JSON example:
Note: UserBean’s “system_id” field must be set.
PUT /users
Request body:
{ "active": true, "administrator": false, "custom_fields": [ {
"system_id": "yahoo_id", "value": "someYahooId456"
} ], "department_system_id": "sales", "email": "[email protected]", "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "password": "somePassword123123", "user_type_system_id": "sales_and_marketing"
}
248 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Response body:
DELETE /users/{system_id}
HTTP Method DELETE Path /users/{system_id} Description Deletes the user with specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User successfully deleted.
304 Not Modified – If user could not be deleted. 404 Not Found – User not found.
Body ErrorBean - failure.
Request example: DELETE /users/jsmith
{ "active": true, "administrator": false, "custom_fields": [ {
"name": "Yahoo ID", "system_id": "yahoo_id", "type_name": "Text", "type_system_id": 1, "value": "someYahooId456", "value_formatted": "someYahooId456"
} ], "department": { "name":
"Sales", "system_id": "sales", "uri": "http://localhost:8080/wpm/api/departments/sales"
}, "email": "[email protected]", "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing", "uri": "http://localhost:8080/wpm/api/userTypes/sales_and_marketing"
} }
249 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /users
HTTP Method GET Path /users Description Search users based on set query parameters. Returns a list of users
which satisfy search criteria.
Available search attributes:
page (Number) page_size (Number) mask (String) name (String) first_name (String) last_name (String) department (String) (department name) user_type (String) (user type name) email (String) login_name (String) system_id (String)
These search attributes are set as query parameters: /users?first_name=john&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with list of UserBeans.
JSON example:
GET /users?first_name=john&user_type=sales&department=sales&last_name=smith&page=1&page_size=5
{ "completed_in": 122, "page": 1, "page_size": 5, "total": 1, "users": [ {
"active": true, "administrator": true, "custom_fields": [ {
250 Workflow API © 2018 SAP, Inc. All Rights Reserved.
"name": "Yahoo ID", "system_id": "yahoo_id", "type_name": "Text", "type_system_id": 1, "value": "someYahooId123", "value_formatted": "someYahooId123"
} ], "department": { "name":
"Sales", "system_id": "sales", "uri": "http://localhost:8080/wpm/api/departments/sales"
}, "email": "[email protected]", "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith", "user_type": { "name": "Sales and Marketing", "system_id": "sales_and_marketing", "uri": "http://localhost:8080/wpm/api/userTypes/sales_and_marketing"
} }
] }
POST /users/create_bulk
HTTP Method POST Path /users/create_bulk Description Creates a list of users based on received list of UserBean objects Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body List of UserBean objects. Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – Users successfully created.
400 Bad Request – Required fields are missing or other constraint error.
Body processed_entity - success. errors – failure.
251 Workflow API © 2018 SAP, Inc. All Rights Reserved.
JSON example:
a) POST /users/create_bulk
Request body:
Response body:
[{ "active": true, "administrator": true, "custom_fields": [{ "system_id": "yahoo_id", "value": "someYahooId123" }], "department_system_id": "sales", "email": "[email protected]", "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "password": "somePassword567", "user_type_system_id": "sales_and_marketing" }, { "active": true, "administrator": true, "custom_fields": [{ "system_id": "yahoo_id", "value": "someYahooId123" }], "department_system_id": "sales", "email": "[email protected]", "first_name": "John", "last_name": "Smith", "login_name": "jsmith", "password": "somePassword567", "user_type_system_id": "sales_and_marketing" }]
{ "errors": [ { "error_code": "USER_EXCEPTION", "error_messages": [ "User name already defined.", "Email name already defined." ], "failed_index": 2 } ], "processed_entities": [ { "login_name": "jsmithm", "password": "somePassword567", "first_name": "John", "last_name": "Smith", "email": "[email protected]", "department": { "name": "Sales", "system_id": "sales", "uri": "http://localhost:8080/wpm/api/departments/sales" }, "administrator": true, "active": true, "system_id": "jsmithm", "uri": "http://localhost:8080/wpm/api/users/jsmithm" } ]
252 Workflow API © 2018 SAP, Inc. All Rights Reserved.
b) If fields which are required are not sent:
Errors - List of messages with error details. Failed_index - Index of user with bad request.
PUT /users/update_bulk
HTTP Method PUT Path /users/update_bulk Description Updates the user based on received list of UserBean objects
Note: UserBean’s system_id attribute has the same value as login_name. We use system_id to find the user. If there is a need to update user’s login name via REST call then system_id has the value of old login name (in order to find the user) and login_name field has the value of new login name.
Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body List of UserBean objcets Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Users successfully updated.
400 Bad Request – Required fields are missing or other constraint error. 404 Not Found – User not found.
Body processed_entity - success. errors – failure.
"errors": [ { "error_code": "USER_EXCEPTION", "error_messages": [ "User name is required."
"email is required." ], "failed_index": 1 } ] }
253 Workflow API © 2018 SAP, Inc. All Rights Reserved.
JSON example: a) PUT /users/update_bulk
Request body:
Response body:
[{ "active": true, "administrator": false, "custom_fields": [{ "system_id": "yahoo_id", "value": "someYahooId456" }], "department_system_id": "sales", "email": "[email protected]", "first_name": Ivan", "last_name": "Smith", "login_name": "jsmith", "password": "somePassword123123", "user_type_system_id": "sales_and_marketing", "system_id": "jsmith" }, { "active": true, "administrator": false, "custom_fields": [{ "system_id": "yahoo_id", "value": "someYahooId456" }], "department_system_id": "sales", "email": "[email protected]", "first_name": "John", "last_name": "Smith", "login_name": "jsmithg", "password": "somePassword123123", "user_type_system_id": "sales_and_marketing", "system_id": "jsmithg" }]
{ "errors": [ { "error_code": "USER_EXCEPTION", "error_messages": [ "User with this system_id: jsmithg doesnt exist.", "Email name already defined." ], "failed_index": 2 } ], "processed_entities": [ { "login_name": "jsmith", "first_name": "Ivan", "last_name": "Smith", "email": "[email protected]", "department": { "name": "Sales", "system_id": "sales", "uri": "http://localhost:8080/wpm/api/departments/sales" }, "administrator": false, "active": true, "system_id": "jsmith", "uri": "http://localhost:8080/wpm/api/users/jsmith" } ] }
254 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /users/{system_id}/custom_fields/{custom_field_system_id}
HTTP Method GET Path /users/{system_id}/custom_fields/{custom_field_system_id} Description Returns specified custom field with its value which is set for specified
user. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom Field found.
404 Not Found – User or Custom Field not found. Body CustomFieldBean - success.
ErrorBean - failure.
JSON example:
GET /users/jsmith/custom_fields/yahoo_id Response body:
{ "name": "Yahoo ID", "system_id": "yahoo_id", "type_name": "Text", "type_system_id": 1, "value": "someYahooId123", "value_formatted": "someYahooId123"
}
251 Workflow API © 2018 SAP, Inc. All Rights Reserved.
POST /users/{system_id}/custom_fields
HTTP Method POST Path /projects/{system_id}/custom_fields Description Sets custom field value to specified user based on received
CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – CustomField value set successfully.
400 Bad Request – Custom Field value is not in the right format. 404 Not Found – User or Custom Field not found
Body ContactBean - success. ErrorBean - failure.
JSON example:
POST /users/jsmith/custom_fields
Request body:
{ "system_id": "yahoo_id", "value": "someYahooId123"
}
252 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /users/{system_id}/custom_fields
HTTP Method PUT Path /users/{system_id}/custom_fields Description Updates custom field value for specified user based on received
CustomFieldBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body CustomFieldBean Response - Output Returned MIME Type application/json HTTP Status Code 200 OK – CustomField value set successfully.
400 Bad Request – Custom Field value is not in the right format. 404 Not Found – User or Custom Field not found
Body ContactBean - success. ErrorBean - failure.
JSON example:
PUT /users/jsmith/custom_fields
Request body:
{ "system_id": "yahoo_id", "value": "someOtherId456"
}
253 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DELETE /users/{system_id}/custom_fields/{custom_field_system_id}
HTTP Method DELETE Path /users/{system_id}/custom_fields/{custom_field_system_id} Description Deletes the value of specified custom field for specified user. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – Custom field value successfully deleted.
404 Not Found – User or Custom Field not found. Body ErrorBean - failure.
Request example: DELETE /users/jsmith/custom_fields/yahoo_id
254 Workflow API © 2018 SAP, Inc. All Rights Reserved.
User Type
Resource: User Type Main path: /user_types
GET /user_types/{system_id}
HTTP Method GET Path /user_types/{system_id} Description Returns the user type with specified system id. Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User Type found.
404 Not Found – User Type not found. Body UserTypeBean - success.
ErrorBean - failure.
JSON example:
a) GET /user_types/jsmith
Response body:
b) GET /user_types/some_non_existing_user_type
{ "name": "Business Analyst", "system_id": "business_analyst", "uri": "http://localhost:8080/wpm/api/userTypes/business_analyst"
}
{ "error_code": "RESOURCE_NOT_FOUND", "error_messages": [ "User type does not exist."
] }
255 Workflow API © 2018 SAP, Inc. All Rights Reserved.
POST /user_types
HTTP Method POST Path /user_types Description Creates a user type based on received UserTypeBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type, Location Request - Input Accepts application/json Expected request body UserTypeBean Response - Output Returned MIME Type application/json HTTP Status Code 201 Created – User type successfully created.
400 Bad Request – Required fields are missing or other constraint error.
Body UserTypeBean - success. ErrorBean - failure.
JSON example:
a) POST /user_types
Request body:
Response body:
b) If fields which are required are not sent:
{ "name": "Business Analyst", "system_id": "business_analyst"
}
{ "name": "Business Analyst", "system_id": "business_analyst", "uri": "http://localhost:8080/wpm/api/user_types/business_analyst"
}
{ "error_code": "CONSTRAINT_VIOLATIONS", "error_messages": [
"UserType name is required” ]
}
256 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PUT /user_types
HTTP Method PUT Path /user_types Description Updates the user type based on received UserTypeBean. Required headers Authorization, domain, Accept, Content-Type Returned headers Content-Type Request - Input Accepts application/json Expected request body UserTypeBean Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User type successfully updated.
400 Bad Request – Required fields are missing or other constraint error. 404 Not Found – User type not found.
Body UserTypeBean - success. ErrorBean - failure.
JSON example:
Note: UserTypeBean’s “system_id” field must be set. PUT /user_types Request body:
Response body:
{ "name": "Business Analyst User Type", "system_id": "business_analyst"
}
{ "name": "Business Analyst User Type", "system_id": "business_analyst", "uri": "http://localhost:8080/wpm/api/user_types/business_analyst"
}
257 Workflow API © 2018 SAP, Inc. All Rights Reserved.
DELETE /user_types/{system_id}
HTTP Method DELETE Path /user_types/{system_id} Description Deletes the user type with specified system id. Required headers Authorization, domain, Accept Returned headers Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK – User type successfully deleted.
304 Not Modified – If user type could not be deleted. 404 Not Found – User type not found.
Body ErrorBean - failure.
Request example: DELETE /user_types/business_analyst
258 Workflow API © 2018 SAP, Inc. All Rights Reserved.
GET /user_types
HTTP Method GET Path /user_types Description Search user types based on set query parameters. Returns a list of
user types which satisfy search criteria.
Available search attributes: page page_size mask name system_id
These search attributes are set as query parameters: /user_types?name= business&page=1&page_size=5
Required headers Authorization, domain, Accept Returned headers Content-Type Request - Input Accepts application/json Expected request body N/A Response - Output Return MIME Type application/json HTTP Status Code 200 OK Body ResultBean with list of UserTypeBeans.
JSON example:
GET /user_types?name=business&page=1&page_size=5
{ "completed_in": 87, "page": 1, "page_size": 10, "total": 1, "user_types": [ {
"name": "Business Analyst", "system_id": "business_analyst", "uri": "http://localhost:8080/wpm/api/user_types/business_analyst"
} ]
}
259 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Appendix A – Countries
This appendix show the list of countries with their system ids:
Country System ID Albania albania Algeria algeria Andorra andorra Angola angola Anguilla anguilla Argentina argentina Armenia armenia Aruba aruba Australia australia Austria austria Azerbaijan azerbaijan Bahamas bahamas Bangladesh bangladesh Barbados barbados Belarus belarus Belgium belgium Benin benin Bermuda bermuda Bhutan bhutan Bolivia bolivia Botswana botswana Bouvet Island bouvet_island Brazil brazil Brunei brunei Bulgaria bulgaria Burkina Faso burkina_faso Burundi burundi Cambodia cambodia Cameroon cameroon Canada canada Cayman Islands cayman_islands Central African Republic central_african_republic Chad chad
260 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Chile chile
China china Cocos (Keeling) Islands cocos_keeling_islands Colombia colombia Comoros comoros Congo congo Costa Rica costa_rica Cote d Ivoire cote_d_ivoire Croatia croatia Cuba cuba Cyprus cyprus Denmark denmark Djibouti djibouti Dominica dominica East Timor east_timor Ecuador ecuador Egypt egypt El Salvador el_salvador Equitorial Guinea equitorial_guinea Eritrea eritrea Estonia estonia Falkland Islands (Islas Malvinas) falkland_islands_islas_malvinas Faroe Islands faroe_islands Fiji fiji France france French Guyana french_guyana French Southern and Antarctic Lands french_southern_and_antarctic_lands Gabon gabon Gambia gambia Gaza Strip gaza_strip Germany germany Ghana ghana Gibraltar gibraltar Greece greece Greenland greenland Guadeloupe guadeloupe Guam guam Guatemala guatemala Guinea guinea Guyana guyana Haiti haiti
261 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Holy See (Vatican City) holy_see_vatican_city
Honduras honduras Hong Kong hong_kong Hungary hungary Iceland iceland India india Indonesia indonesia Iran iran Iraq iraq Ireland ireland Italy italy Jamaica jamaica Japan japan Jordan jordan Kenya kenya Kiribati kiribati Kuwait kuwait Kyrgyzstan kyrgyzstan Laos laos Latvia latvia Lebanon lebanon Liberia liberia Libya libya Liechtenstein liechtenstein Lithuania lithuania Macau macau Macedonia - FYR macedonia_fyr Madagascar madagascar Malawi malawi Maldives maldives Mali mali Afghanistan afghanistan American Samoa american_samoa Antigua and Barbuda antigua_and_barbuda Bahrain bahrain Belize belize Bosnia and Herzegovina bosnia_and_herzegovina British Virgin Islands british_virgin_islands Cape Verde cape_verde Christmas Island christmas_island Cook Islands cook_islands
262 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Czech Republic czech_republic
Dominican Republic dominican_republic Ethiopia ethiopia Finland finland French Polynesia french_polynesia Marshall Islands marshall_islands Martinique martinique Mauritania mauritania Mayotte mayotte Mexico mexico Moldova moldova Monaco monaco Mongolia mongolia Montenegro montenegro Montserrat montserrat Morocco morocco Mozambique mozambique Myanmar myanmar Namibia namibia Naura naura Netherlands netherlands New Caledonia new_caledonia New Zealand new_zealand Nicaragua nicaragua Niger niger Nigeria nigeria Niue niue Norfolk Island norfolk_island Northern Mariana Islands northern_mariana_islands Norway norway Oman oman Palau palau Panama panama Papua New Guinea papua_new_guinea Peru peru Philippines philippines Pitcairn Islands pitcairn_islands Poland poland Puerto Rico puerto_rico Qatar qatar Reunion reunion
263 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Romania romania
Russia russia Rwanda rwanda Saint Lucia saint_lucia Samoa samoa San Marino san_marino Sao Tome and Principe sao_tome_and_principe Saudi Arabia saudi_arabia Senegal senegal Serbia serbia Seychelles seychelles Sierra Leone sierra_leone Singapore singapore Slovenia slovenia Solomon Islands solomon_islands Somalia somalia South Georgia south_georgia South Korea south_korea Spain spain Sri Lanka sri_lanka St. Helena st_helena Sudan sudan Suriname suriname Svalbard svalbard Swaziland swaziland Switzerland switzerland Syria syria Taiwan taiwan Tajikistan tajikistan Tanzania tanzania Togo togo Tokelau tokelau Tonga tonga Tunisia tunisia Turkey turkey Turkmenistan turkmenistan Turks and Caicos Islands turks_and_caicos_islands Tuvalu tuvalu Uganda uganda United Arab Emirates united_arab_emirates United Kingdom united_kingdom
264 Workflow API © 2018 SAP, Inc. All Rights Reserved.
USA usa
Uruguay uruguay Uzbekistan uzbekistan Vanuatu vanuatu Venezuela venezuela Vietnam vietnam West Bank west_bank Western Sahara western_sahara Yemen yemen Zambia zambia Zimbabwe zimbabwe Georgia georgia Grenada grenada Guinea-Bissau guinea_bissau Heard Island and McDonald Islands heard_island_and_mcdonald_islands Israel israel Kazakhstan kazakhstan Lesotho lesotho Luxembourg luxembourg Malaysia malaysia Malta malta Mauritius mauritius Micronesia - Federated States of micronesia_federated_states_of Nepal nepal Netherlands Antilles netherlands_antilles North Korea north_korea Pakistan pakistan Paraguay paraguay Portugal portugal Saint Kitts and Nevis saint_kitts_and_nevis Saint Vincent and the Grenadines saint_vincent_and_the_grenadines Slovakia slovakia South Africa south_africa St. Pierre and Miquelon st_pierre_and_miquelon Sweden sweden Thailand thailand Trinidad and Tobago trinidad_and_tobago Ukraine ukraine United States Virgin Islands united_states_virgin_islands Wallis and Futuna wallis_and_futuna
265 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Appendix B – States
This appendix show the list of states with their system ids:
State System ID Alabama AL Alaska AK Alberta AB Arizona AZ Arkansas AR Armed Forces Americas AA Armed Forces Other AE Armed Forces Pacific AP British Columbia BC California CA Colorado CO Connecticut CT Delaware DE District of Columbia DC Florida FL Georgia GA Hawaii HI Idaho ID Illinois IL Indiana IN Iowa IA Kansas KS Kentucky KY Louisiana LA Maine ME Manitoba MB Maryland MD Massachusetts MA Michigan MI Mississippi MS Minnesota MN Missouri MO Montana MT
266 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Nebraska NE
Nevada NV New Brunswick NB New Hampshire NH New Jersey NJ New Mexico NM New York NY Newfoundland NL North Carolina NC North Dakota ND Northwest Territories NT Nova Scotia NS Ohio OH Oklahoma OK Ontario ON Oregon OR Pennsylvania PA Prince Edward Island PE Puerto Rico PR Quebec QC Rhode Island RI Saskatchewan SK South Carolina SC South Dakota SD Tennessee TN Texas TX Utah UT Vermont VT Virgin Islands VI Virginia VA Washington WA West Virginia WV Wisconsin WI Wyoming WY Yukon YT Nunavut NU Labrador NF
267 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Appendix C – Custom Field Types
This appendix show the list of Custom Field Types which can be created via Workflow REST API:
Custom Field Type System ID Autocomplete 35 Checkbox 8 Constant 20 Currency 33 Date 3 Date and Time 16 Decimal Number 18 Email 11 Large Text 5 Multiple Autocomplete 36 Multiple Choice Pick Up List 9 Number 2 Percent 19 Pick List 6 Radio Button 7 Rich Text Editor 28 Text 1 Url 10
268 Workflow API © 2018 SAP, Inc. All Rights Reserved.
Appendix D – Error Codes
This appendix shows the list of error codes that can be returned via ErrorBean:
Error Code Description BAD_DATE_FORMAT Submitted date value is not in the right format. BAD_DATE_TIME_FORMAT Submitted date time value is not in the right format. CASES_ALREADY_RELATED Two cases are already related. CASES_NOT_RELATED Two cases are not related. CONSTRAINT_DELETE_VIOLATIONS Resource (entity) cannot be deleted because of
delete constraint.
CONSTRAINT_NOT_UNIQUE_VIOLATION Sent resource’s (entity’s) property must be unique. CONSTRAINT_VIOLATIONS Specified action is trying to violate existing
constraints.
CUSTOM_FIELD_REQUIRED Custom Field which is required to be submitted on action form is not sent.
CUSTOM_FIELD_VALUE_DOES_NOT_EXIST Non existing predefined value is submitted. CUSTOM_FIELD_VALUE_NOT_VALID Custom Field value is not valid. (E.g. text value
‘thousand’ is sent for decimal field type.)
CUSTOM_TABLE_OPERATIONS_FAILED Custom table operation not completed. (adding a new row, retrieving values etc.)
FILE_NOT_UPLOADED File upload was not successful. FILE_TOO_LARGE Uploaded file is larger than it is allowed. ILLEGAL_ACCESS User does not have a permission to perform the
specific call.
ILLEGAL_FILE_EXTENSION Uploaded file does not have required type. ILLEGAL_QUERY Query contains illegal words. IMPORT_FAILED Custom table import failed.
INVALID_ACTION_ARGUMENT Executing action failed. INVALID_SYSTEM_ID Field with specified System ID does not exist. LENGTH_GREATER_THAN_MAXIMUM Submitted Custom Field value is larger than
maximum value for that Custom Field.
LENGTH_LESS_THAN_MINUMUM Submitted Custom Field value is less than mimimun value for that Custom Field.
269 Workflow API © 2018 SAP, Inc. All Rights Reserved.
PERMISSION_DENIED User does not have a permission to perform requested action.
PROPERTY_NULL Bean’s property is not submitted or has null value. QUERY_NOT_EXECUTED Query execution failed.
RESOURCE_ALREADY_EXISTS The same resource (entity) is already created. RESOURCE_NOT_FOUND Requested resource (entity) does not exist.
© 2018 SAP, Inc. All Rights Reserved.
Overview
DESCRIPTION CONSUMES INPUT PRODUCES
Returns the account with specified system id. application/json
Creates an account based on received AccountBean. application/json AccountBean application/json
Updates the account based on received AccountBean. application/json AccountBean application/json
Deletes the account with specified system id. application/json
Search accounts based on set query parameters. Returns a list of accounts which satisfy search criteria.
application/json Query parameters. application/json
/accounts/{system_id}/custom_fields/{custom_field_system_id} Returns specified custom field with its value which is set for specified account.
application/json
Sets custom field value to specified account based on received CustomFieldBean.
application/json CustomFieldBean application/json
Updates custom field value in specified account based on received CustomFieldBean.
application/json CustomFieldBean application/json
/accounts/{system_id}/custom_fields/{custom_field_system_id} Deletes the value of specified custom field for specified account.
application/json
DESCRIPTION CONSUMES INPUT PRODUCES
Returns the case with specified system id. application/json
Creates a case based on received CaseBean. application/json CaseBean application/json
Creates a case based on received CaseBean. Cases creator is user with system id “user_system_id”.
application/json CaseBean application/json
Updates the case based on received CaseBean. application/json CaseBean application/json
Updates the case based on received CaseBean. Cases updater is user with system id “user_system_id”.
application/json CaseBean application/json
Deletes the case with specified system id. application/json
© 2018 SAP, Inc. All Rights Reserved.
Returns a list of cases in which user performing the REST call is the follower.
application/json
Returns a list of cases in which user with specified system id is the follower.
application/json
Returns a list of cases in which user performing the REST call is the team member.
application/json
/cases/system_list/team_member/{user_system_id} Returns a list of cases in which user with specified system id is the team member.
application/json
Returns a list of related cases for case with specified system id.
application/json
Returns a list of all cases from which case with specified system id is related.
application/json
/cases/{system_id}/related_cases/{related_system_id} Creates a relation between two existing cases. To case with system id "system_id" sets related case with system id "related_system_id".
application/json
/cases/{system_id}/related_cases/{related_system_id} Deletes the relation between case with system id "system_id" and its related case with system id "related_system_id".
application/json
/cases/{system_id}/custom_fields/{custom_field_system_id} Returns specified custom field with its value which is set for specified case.
application/json
Sets custom field value in specified case based on received CustomFieldBean.
application/json CustomFieldBean application/json
Updates custom field value in specified case based on received CustomFieldBean.
application/json CustomFieldBean application/json
/cases/{system_id}/custom_fields/{custom_field_system_id} Deletes the value of specified custom field in specified case.
application/json
Returns a list of attachments from specified case which user who is performing a REST call has permission to see.
application/json
/cases/{system_id}/attachments/{attachment_system_id} Returns attached file with specified attachment_system_id from case with system id “system_id”.
application/octetstream
Uploads attachment to specified case. multipart/form-data Form parameters application/json
/cases/{system_id}/attachments/{attachment_system_id} Deletes the attachment with specified attachment_system_id which is associated with specified system id.
application/json
Returns a list of comments from specified case which user who is performing a REST call has permission to see.
application/json
/cases/{system_id}/comments/{comment_system_id} Returns comment with specified comment_system_id from case with specified system id.
application/json
3. Creates a comment based on received CommentBean in case with specified system
application/json CommentBean application/json
© 2018 SAP, Inc. All Rights Reserved.
DESCRIPTION CONSUMES INPUT PRODUCES
Returns case type with specified system id. application/json
Search case types based on set query parameters. Returns a list of case types which satisfy search criteria.
application/json Query parameters. application/json
Returns statuses associated with specified case type. application/json
/case_types/{system_id}/statuses/{status_system_id}/actions Returns actions in specified status for specified case type.
application/json
DESCRIPTION CONSUMES INPUT PRODUCES
Returns company with specified system id. application/json
Creates a company based on received CompanyBean. application/json CompanyBean application/json
Updates the company based on received CompanyBean.
application/json CompanyBean application/json
Deletes the company with specified system id. application/json
Search companies based on set query parameters. Returns a list of companies which satisfy search criteria.
application/json Query parameters. application/json
DESCRIPTION CONSUMES INPUT PRODUCES
Returns contact with specified system id. application/json
Creates a contact based on received ContactBean. application/json ContactBean application/json
© 2018 SAP, Inc. All Rights Reserved.
DESCRIPTION CONSUMES INPUT PRODUCES
Returns custom table with specified system id. application/json
Creates a custom table based on received CustomTableBean.
application/json CustomTableBean application/json
Deletes the custom table with specified system id. CustomTableBean application/json
Search custom tables based on set query parameters. Returns a list of custom tables which satisfy search criteria.
application/json application/json
/custom_tables/{system_id}/column/{column_name} Adds a column with specified name into specified custom table.
application/json Query parameters. application/json
Returns rows from specified custom table. application/json
Returns row with specified oid (object id) from specified custom table.
application/json
Adds one row in specified custom table based on received row in CustomTableBean.
application/json CustomTableBean with one row.
application/json
Updates the row in specified custom table based on received row in CustomTableBean.
application/json CustomTableBean with one row.
application/json
Deletes the row with specified oid in specified custom table.
application/json
Executes select query sent via QueryBean and returns rows from custom table.
application/json QueryBean application/json
Inserts data into custom table based on sent query in QueryBean.
application/json QueryBean application/json
Updates data in custom table based on sent query in QueryBean.
application/json QueryBean application/json
Deletes data in custom table based on sent query in QueryBean.
application/json QueryBean application/json
Creates a new custom table with rows from uploaded csv file.
multipart/form-data CSV file application/json
Updates rows in specified custom table from uploaded csv file.
multipart/form-data CSV file application/json
Exports rows from custom table to CSV file based on application/json QueryBean application/octet
© 2018 SAP, Inc. All Rights Reserved.
set query parameters. Returns a list of unread messages which satisfy search criteria and marks returned messages as read.
Returns the number of unread messages for specified user.
application/json application/json
DESCRIPTION CONSUMES INPUT PRODUCES
Returns project with specified system id. application/json
Creates a project based on received ProjectBean. application/json ProjectBean application/json
Updates the project based on received ProjectBean. application/json ProjectBean application/json
Deletes the project with specified system id. application/json
Search projects based on set query parameters. Returns a list of projects which satisfy search criteria.
application/json Query parameters. application/json
/projects/{system_id}/custom_fields/{custom_field_system_id} Returns specified custom field with its value which is set for specified project.
application/json
Sets custom field value to specified project based on received CustomFieldBean.
application/json CustomFieldBean application/json
Updates custom field value in specified project based on received CustomFieldBean.
application/json CustomFieldBean application/json
/projects/{system_id}/custom_fields/{custom_field_system_id} Deletes the value of specified custom field for specified project.
application/json
DESCRIPTION CONSUMES INPUT PRODUCES
Returns user with specified system id. application/json
Creates a user based on received UserBean. application/json UserBean application/json
Updates the user based on received UserBean. application/json UserBean application/json
Deletes the user with specified system id. application/json
Search users based on set query parameters. Returns a list of users which satisfy search
application/json Query parameters. application/json