Skip to content

Commit 1c2074c

Browse files
CEX-736 feat: add workflow execution statuses to product and product model APIs (#1120)
* feat: add workflow execution statuses to product and product model APIs - Introduced a new query parameter `with_workflow_execution_statuses` to retrieve workflow execution statuses associated with products and product models. - Updated the product and product model definitions to include `workflow_execution_statuses` as an array of objects containing details about the workflow execution, including status, timestamps, and associated tasks. - Enhanced example responses in the API documentation to reflect the new workflow execution statuses. - Modified relevant routes to support the new query parameter and ensure proper pagination links include it. * CEX-736: akeneo-web-api.json --------- Co-authored-by: Paul Chasle <[email protected]> Co-authored-by: Bryan Stéphan <[email protected]>
1 parent 2d8644a commit 1c2074c

File tree

13 files changed

+510
-16
lines changed

13 files changed

+510
-16
lines changed

content/swagger/akeneo-web-api.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

content/swagger/parameters.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,15 @@ convert_measurements:
204204
type: boolean
205205
required: false
206206
x-from-version: "SaaS"
207+
with_workflow_execution_statuses:
208+
name: with_workflow_execution_statuses
209+
in: query
210+
description: |
211+
Return an array of workflow_execution_statuses directly associated with the requested entity (product or product model) in the response.
212+
Statuses are level-specific and are not inherited from parent models. For a complete overview of a variant product, you must query the variant itself and its parent model(s) in separate requests.
213+
Each workflow object contains:
214+
- The overall execution status (e.g., in_progress, completed).
215+
- A list of all associated tasks.
216+
required: false
217+
type: boolean
218+
x-from-version: "SaaS"

content/swagger/resources/product_models/definitions/product_model.yaml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,76 @@ properties:
140140
x-immutable: true
141141
x-read-only: true
142142
x-from-version: "7.0"
143+
workflow_execution_statuses:
144+
type: array
145+
description: |
146+
Workflow execution statuses of the product (only available when the "with_workflow_execution_statuses" query parameter is set to "true")
147+
x-immutable: true
148+
x-read-only: true
149+
x-from-version: 'SaaS'
150+
items:
151+
type: object
152+
properties:
153+
uuid:
154+
type: string
155+
description: Workflow execution UUID
156+
status:
157+
type: string
158+
description: Status of the workflow execution
159+
enum: [in_progress, completed]
160+
started_at:
161+
type: string
162+
format: date-time
163+
description: Date and time when the workflow execution was started
164+
completed_at:
165+
type: [string, "null"]
166+
format: date-time
167+
description: Date and time when the workflow execution was completed, null if still in progress
168+
workflow:
169+
type: object
170+
properties:
171+
uuid:
172+
type: string
173+
description: Workflow UUID
174+
code:
175+
type: string
176+
description: Workflow code
177+
labels:
178+
type: object
179+
description: Workflow labels for each locale
180+
additionalProperties:
181+
type: string
182+
tasks:
183+
type: array
184+
description: Tasks associated with the workflow execution
185+
items:
186+
type: object
187+
properties:
188+
uuid:
189+
type: string
190+
description: Task UUID
191+
status:
192+
type: string
193+
description: Status of the task
194+
enum: [in_progress]
195+
created_at:
196+
type: string
197+
format: date-time
198+
description: Date and time when the task was created
199+
step:
200+
type: object
201+
properties:
202+
uuid:
203+
type: string
204+
description: Step UUID
205+
code:
206+
type: string
207+
description: Step code
208+
labels:
209+
type: object
210+
description: Step labels for each locale
211+
additionalProperties:
212+
type: string
143213

144214
example: {
145215
"code": "model-biker-jacket-leather",
@@ -240,6 +310,49 @@ example: {
240310
"data": "E"
241311
}
242312
],
313+
"workflow_execution_statuses": [
314+
{
315+
"uuid": "8c0fe59f-4d29-4faa-b4c3-d327e7f3cc52",
316+
"status": "in_progress",
317+
"started_at": "2024-02-22T17:31:00Z",
318+
"completed_at": null,
319+
"workflow": {
320+
"uuid": "6f37476a-04c2-46c0-b6d0-e18316959068",
321+
"code": "enrichment_workflow",
322+
"labels": {
323+
"en_US": "Enrichment workflow",
324+
"fr_FR": "Workflow d'enrichissement"
325+
}
326+
},
327+
"tasks": [
328+
{
329+
"uuid": "8f6c2d18-fbd4-4f7e-81df-cb3dc368fe07",
330+
"status": "in_progress",
331+
"created_at": "2024-02-22T17:31:00Z",
332+
"step": {
333+
"uuid": "f626d0e5-84a5-41fc-8215-65508c253edb",
334+
"code": "review_step",
335+
"labels": {
336+
"en_US": "Marketing review",
337+
"fr_FR": "Revue marketing"
338+
}
339+
}
340+
}
341+
]
342+
},
343+
{
344+
"uuid": "59169984-6d6c-4fa7-b925-68b8e9d31ddb",
345+
"status": "completed",
346+
"started_at": "2024-02-22T17:31:00Z",
347+
"completed_at": "2024-02-22T17:31:00Z",
348+
"workflow": {
349+
"uuid": "b69ee158-a421-4680-bec0-a71bc73b8e31",
350+
"code": "compliance_workflow",
351+
"labels": {}
352+
},
353+
"tasks": []
354+
}
355+
],
243356
"created": "2017-10-02T15:03:55+02:00",
244357
"updated": "2017-10-02T15:03:55+02:00"
245358
}

content/swagger/resources/product_models/routes/product_models.yaml

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ get:
4242
- $ref: '#/parameters/with_attribute_options__product_models'
4343
- $ref: '#/parameters/with_asset_share_links'
4444
- $ref: '#/parameters/with_quality_scores__product_models'
45+
- $ref: '#/parameters/with_workflow_execution_statuses'
4546
responses:
4647
200:
4748
description: Return product models paginated
@@ -61,13 +62,13 @@ get:
6162
examples: {
6263
"_links": {
6364
"self": {
64-
"href": "http://demo.akeneo.com/api/rest/v1/product-models?pagination_type=search_after&limit=3&search_after=qg%3D%3D"
65+
"href": "http://demo.akeneo.com/api/rest/v1/product-models?with_quality_scores=true&with_workflow_execution_statuses=true&pagination_type=search_after&limit=3&search_after=qg%3D%3D"
6566
},
6667
"first": {
67-
"href": "http://demo.akeneo.com/api/rest/v1/product-models?pagination_type=search_after&limit=3"
68+
"href": "http://demo.akeneo.com/api/rest/v1/product-models?with_quality_scores=true&with_workflow_execution_statuses=true&pagination_type=search_after&limit=3"
6869
},
6970
"next": {
70-
"href": "http://demo.akeneo.com/api/rest/v1/product-models?pagination_type=search_after&limit=3&search_after=rw%3D%3D"
71+
"href": "http://demo.akeneo.com/api/rest/v1/product-models?with_quality_scores=true&with_workflow_execution_statuses=true&pagination_type=search_after&limit=3&search_after=rw%3D%3D"
7172
}
7273
},
7374
"_embedded": {
@@ -153,6 +154,49 @@ get:
153154
"data": "E"
154155
}
155156
],
157+
"workflow_execution_statuses": [
158+
{
159+
"uuid": "8c0fe59f-4d29-4faa-b4c3-d327e7f3cc52",
160+
"status": "in_progress",
161+
"started_at": "2024-02-22T17:31:00Z",
162+
"completed_at": null,
163+
"workflow": {
164+
"uuid": "6f37476a-04c2-46c0-b6d0-e18316959068",
165+
"code": "enrichment_workflow",
166+
"labels": {
167+
"en_US": "Enrichment workflow",
168+
"fr_FR": "Workflow d'enrichissement"
169+
}
170+
},
171+
"tasks": [
172+
{
173+
"uuid": "8f6c2d18-fbd4-4f7e-81df-cb3dc368fe07",
174+
"status": "in_progress",
175+
"created_at": "2024-02-22T17:31:00Z",
176+
"step": {
177+
"uuid": "f626d0e5-84a5-41fc-8215-65508c253edb",
178+
"code": "review_step",
179+
"labels": {
180+
"en_US": "Marketing review",
181+
"fr_FR": "Revue marketing"
182+
}
183+
}
184+
}
185+
]
186+
},
187+
{
188+
"uuid": "59169984-6d6c-4fa7-b925-68b8e9d31ddb",
189+
"status": "completed",
190+
"started_at": "2024-02-22T17:31:00Z",
191+
"completed_at": "2024-02-22T17:31:00Z",
192+
"workflow": {
193+
"uuid": "b69ee158-a421-4680-bec0-a71bc73b8e31",
194+
"code": "compliance_workflow",
195+
"labels": {}
196+
},
197+
"tasks": []
198+
}
199+
],
156200
"created": "2017-10-04T18:04:10+02:00",
157201
"updated": "2017-10-04T18:04:10+02:00"
158202
},
@@ -228,6 +272,7 @@ get:
228272
"data": "E"
229273
}
230274
],
275+
"workflow_execution_statuses": [],
231276
"created": "2017-10-04T18:04:10+02:00",
232277
"updated": "2017-10-04T18:04:10+02:00"
233278
},
@@ -271,6 +316,7 @@ get:
271316
},
272317
},
273318
"quantified_associations": {},
319+
"workflow_execution_statuses": [],
274320
"created": "2017-10-04T18:04:10+02:00",
275321
"updated": "2017-10-04T18:04:10+02:00"
276322
}

content/swagger/resources/products/definitions/examples/products.yaml

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,16 +1005,16 @@ x-5.0: {
10051005
x-SaaS: {
10061006
_links: {
10071007
self: {
1008-
href: "https://demo.akeneo.com/api/rest/v1/products?page=3&limit=3&with_quality_scores=true&with_completenesses=true&with_attribute_options=true"
1008+
href: "https://demo.akeneo.com/api/rest/v1/products?page=3&limit=3&with_quality_scores=true&with_completenesses=true&with_attribute_options=true&with_workflow_execution_statuses=true"
10091009
},
10101010
first: {
1011-
href: "https://demo.akeneo.com/api/rest/v1/products?page=1&limit=3&with_quality_scores=true&with_completenesses=true&with_attribute_options=true"
1011+
href: "https://demo.akeneo.com/api/rest/v1/products?page=1&limit=3&with_quality_scores=true&with_completenesses=true&with_attribute_options=true&with_workflow_execution_statuses=true"
10121012
},
10131013
previous: {
1014-
href: "https://demo.akeneo.com/api/rest/v1/products?page=2&limit=3&with_quality_scores=true&with_completenesses=true&with_attribute_options=true"
1014+
href: "https://demo.akeneo.com/api/rest/v1/products?page=2&limit=3&with_quality_scores=true&with_completenesses=true&with_attribute_options=true&with_workflow_execution_statuses=true"
10151015
},
10161016
next: {
1017-
href: "https://demo.akeneo.com/api/rest/v1/products?page=4&limit=3&with_quality_scores=true&with_completenesses=true&with_attribute_options=true"
1017+
href: "https://demo.akeneo.com/api/rest/v1/products?page=4&limit=3&with_quality_scores=true&with_completenesses=true&with_attribute_options=true&with_workflow_execution_statuses=true"
10181018
}
10191019
},
10201020
current_page: 3,
@@ -1214,6 +1214,49 @@ x-SaaS: {
12141214
"locale": "fr_FR",
12151215
"data": 70
12161216
}
1217+
],
1218+
"workflow_execution_statuses": [
1219+
{
1220+
"uuid": "8c0fe59f-4d29-4faa-b4c3-d327e7f3cc52",
1221+
"status": "in_progress",
1222+
"started_at": "2024-02-22T17:31:00Z",
1223+
"completed_at": null,
1224+
"workflow": {
1225+
"uuid": "6f37476a-04c2-46c0-b6d0-e18316959068",
1226+
"code": "enrichment_workflow",
1227+
"labels": {
1228+
"en_US": "Enrichment workflow",
1229+
"fr_FR": "Workflow d'enrichissement"
1230+
}
1231+
},
1232+
"tasks": [
1233+
{
1234+
"uuid": "8f6c2d18-fbd4-4f7e-81df-cb3dc368fe07",
1235+
"status": "in_progress",
1236+
"created_at": "2024-02-22T17:31:00Z",
1237+
"step": {
1238+
"uuid": "f626d0e5-84a5-41fc-8215-65508c253edb",
1239+
"code": "review_step",
1240+
"labels": {
1241+
"en_US": "Marketing review",
1242+
"fr_FR": "Revue marketing"
1243+
}
1244+
}
1245+
}
1246+
]
1247+
},
1248+
{
1249+
"uuid": "59169984-6d6c-4fa7-b925-68b8e9d31ddb",
1250+
"status": "completed",
1251+
"started_at": "2024-02-22T17:31:00Z",
1252+
"completed_at": "2024-02-22T17:31:00Z",
1253+
"workflow": {
1254+
"uuid": "b69ee158-a421-4680-bec0-a71bc73b8e31",
1255+
"code": "compliance_workflow",
1256+
"labels": {}
1257+
},
1258+
"tasks": []
1259+
}
12171260
]
12181261
},
12191262
{
@@ -1347,7 +1390,8 @@ x-SaaS: {
13471390
"locale": "fr_FR",
13481391
"data": 70
13491392
}
1350-
]
1393+
],
1394+
"workflow_execution_statuses": []
13511395
},
13521396
{
13531397
"_links": {
@@ -1369,7 +1413,8 @@ x-SaaS: {
13691413
"associations": {},
13701414
"quantified_associations": {},
13711415
"quality_scores": {},
1372-
"completenesses": []
1416+
"completenesses": [],
1417+
"workflow_execution_statuses": []
13731418
}
13741419
]
13751420
}

0 commit comments

Comments
 (0)