The Knowledge Store REST API enables you to interact with your projects and spaces in jBPM without using the Business Central user interface. You can send Knowledge Store REST API requests using any REST client or curl utility.
Prerequisites
Business Central is installed and running.
You have rest-all user role access to Business Central.
- 1
- 2
- 3
Procedure
Identify the relevant API endpoint to which you want to send a request, such as [GET] /spaces to retrieve spaces in Business Central.
In a REST client or curl utility, enter the following components for a GET request to /spaces. Adjust any request details according to your use case.
For REST client:
Authentication: Enter the user name and password of the Business Central user with the rest-all role.
HTTP Headers: Set the following header:
Accept: application/json
HTTP method: Set to GET.
URL: Enter the Knowledge Store REST API base URL and endpoint, such as http://localhost:8080/business-central/rest/spaces.
For curl utility:
-u: Enter the user name and password of the Business Central user with the rest-all role.
-H: Set the following header:
accept: application/json
-X: Set to GET.
URL: Enter the Knowledge Store REST API base URL and endpoint, such as http://localhost:8080/business-central/rest/spaces.
curl -u 'baAdmin:password@1' -H "accept: application/json" -X GET "http://localhost:8080/business-central/rest/spaces"
Execute the request and review the KIE Server response.
Example server response (JSON):
[
{
"name": "MySpace",
"description": null,
"projects": [
{
"name": "Employee_Rostering",
"spaceName": "MySpace",
"groupId": "employeerostering",
"version": "1.0.0-SNAPSHOT",
"description": "Employee rostering problem optimisation using Planner. Assigns employees to shifts based on their skill.",
"publicURIs": [
{
"protocol": "git",
"uri": "git://localhost:9418/MySpace/example-Employee_Rostering"
},
{
"protocol": "ssh",
"uri": "ssh://localhost:8001/MySpace/example-Employee_Rostering"
}
]
},
{
"name": "Mortgage_Process",
"spaceName": "MySpace",
"groupId": "mortgage-process",
"version": "1.0.0-SNAPSHOT",
"description": "Getting started loan approval process in BPMN2, decision table, business rules, and forms.",
"publicURIs": [
{
"protocol": "git",
"uri": "git://localhost:9418/MySpace/example-Mortgage_Process"
},
{
"protocol": "ssh",
"uri": "ssh://localhost:8001/MySpace/example-Mortgage_Process"
}
]
}
],
"owner": "admin",
"defaultGroupId": "com.myspace"
},
{
"name": "MySpace2",
"description": null,
"projects": [
{
"name": "IT_Orders",
"spaceName": "MySpace",
"groupId": "itorders",
"version": "1.0.0-SNAPSHOT",
"description": "Case Management IT Orders project",
"publicURIs": [
{
"protocol": "git",
"uri": "git://localhost:9418/MySpace/example-IT_Orders-1"
},
{
"protocol": "ssh",
"uri": "ssh://localhost:8001/MySpace/example-IT_Orders-1"
}
]
}
],
"owner": "admin",
"defaultGroupId": "com.myspace"
}
]
In your REST client or curl utility, send another API request with the following components for a POST request to /spaces/{spaceName}/projects to create a project within a space. Adjust any request details according to your use case.
For REST client:
Authentication: Enter the user name and password of the Business Central user with the rest-all role.
HTTP Headers: Set the following header:
Accept: application/json
Content-Type: application/json
HTTP method: Set to POST.
URL: Enter the Knowledge Store REST API base URL and endpoint, such as http://localhost:8080/business-central/rest/spaces/MySpace/projects.
Request body: Add a JSON request body with the identification data for the new project:
{
"name": "Employee_Rostering",
"groupId": "employeerostering",
"version": "1.0.0-SNAPSHOT",
"description": "Employee rostering problem optimisation using Planner. Assigns employees to shifts based on their skill."
}
For curl utility:
-u: Enter the user name and password of the Business Central user with the rest-all role.
-H: Set the following headers:
accept: application/json
content-type: application/json
-X: Set to POST.
URL: Enter the Knowledge Store REST API base URL and endpoint, such as http://localhost:8080/business-central/rest/spaces/MySpace/projects.
-d: Add a JSON request body or file (@file.json) with the identification data for the new project:
curl -u 'baAdmin:password@1' -H "accept: application/json" -H "content-type: application/json" -X POST "http://localhost:8080/business-central/rest/spaces/MySpace/projects" -d "{ \"name\": \"Employee_Rostering\", \"groupId\": \"employeerostering\", \"version\": \"1.0.0-SNAPSHOT\", \"description\": \"Employee rostering problem optimisation using Planner. Assigns employees to shifts based on their skill.\"}"
curl -u 'baAdmin:password@1' -H "accept: application/json" -H "content-type: application/json" -X POST "http://localhost:8080/business-central/rest/spaces/MySpace/projects" -d @my-project.json
Execute the request and review the KIE Server response.
Example server response (JSON):
{
"jobId": "1541017411591-6",
"status": "APPROVED",
"spaceName": "MySpace",
"projectName": "Employee_Rostering",
"projectGroupId": "employeerostering",
"projectVersion": "1.0.0-SNAPSHOT",
"description": "Employee rostering problem optimisation using Planner. Assigns employees to shifts based on their skill."
}
If you encounter request errors, review the returned error code messages and adjust your request accordingly.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164