# Workflows

## GET /v1/workflows

> Get all workflows in the system

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Workflows","description":""}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}},"schemas":{"Struct.App.Api.Models.Workflow.WorkflowModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow","format":"uuid"},"Alias":{"type":"string","description":"Alias of the workflow","nullable":true},"Label":{"type":"string","description":"Label of the workflow","nullable":true},"DefaultStateUid":{"type":"string","description":"The default state of the workflow","format":"uuid"},"States":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowStateModel"},"description":"The states of the workflow","nullable":true},"ProductAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to products using the product structures","nullable":true},"VariantAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to variants using the product structures","nullable":true},"CatalogueAssignmentCatalogueUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to categories in the catalogues","nullable":true},"AssetAssignmentAssetTypeUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to asset types","nullable":true},"VariantGroupAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to variant groups using the product structures","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow"},"Struct.App.Api.Models.Workflow.WorkflowStateModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow state","format":"uuid"},"Alias":{"type":"string","description":"Alias of the workflow state","nullable":true},"Label":{"type":"string","description":"Label of the workflow state","nullable":true},"Transitions":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowTransitionModel"},"description":"The transitions of the workflow","nullable":true},"Color":{"type":"string","description":"The color of the state in the UI","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow state"},"Struct.App.Api.Models.Workflow.WorkflowTransitionModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow transition","format":"uuid"},"TransitionToStateUid":{"type":"string","description":"The state it can transition to","format":"uuid"},"Label":{"type":"string","description":"Label of the workflow transition","nullable":true},"Description":{"type":"string","description":"Description of the workflow transition","nullable":true},"RequiredPermission":{"type":"string","description":"The required permission to use the transition","format":"uuid","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow transition"}}},"paths":{"/v1/workflows":{"get":{"tags":["Workflows"],"summary":"Get all workflows in the system","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowModel"}}}}}}}}}}
```

## POST /v1/workflows

> Create a workflow

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Workflows","description":""}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}},"schemas":{"Struct.App.Api.Models.Workflow.WorkflowModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow","format":"uuid"},"Alias":{"type":"string","description":"Alias of the workflow","nullable":true},"Label":{"type":"string","description":"Label of the workflow","nullable":true},"DefaultStateUid":{"type":"string","description":"The default state of the workflow","format":"uuid"},"States":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowStateModel"},"description":"The states of the workflow","nullable":true},"ProductAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to products using the product structures","nullable":true},"VariantAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to variants using the product structures","nullable":true},"CatalogueAssignmentCatalogueUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to categories in the catalogues","nullable":true},"AssetAssignmentAssetTypeUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to asset types","nullable":true},"VariantGroupAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to variant groups using the product structures","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow"},"Struct.App.Api.Models.Workflow.WorkflowStateModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow state","format":"uuid"},"Alias":{"type":"string","description":"Alias of the workflow state","nullable":true},"Label":{"type":"string","description":"Label of the workflow state","nullable":true},"Transitions":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowTransitionModel"},"description":"The transitions of the workflow","nullable":true},"Color":{"type":"string","description":"The color of the state in the UI","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow state"},"Struct.App.Api.Models.Workflow.WorkflowTransitionModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow transition","format":"uuid"},"TransitionToStateUid":{"type":"string","description":"The state it can transition to","format":"uuid"},"Label":{"type":"string","description":"Label of the workflow transition","nullable":true},"Description":{"type":"string","description":"Description of the workflow transition","nullable":true},"RequiredPermission":{"type":"string","description":"The required permission to use the transition","format":"uuid","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow transition"},"Microsoft.AspNetCore.Mvc.ProblemDetails":{"type":"object","properties":{"Type":{"type":"string","nullable":true},"Title":{"type":"string","nullable":true},"Status":{"type":"integer","format":"int32","nullable":true},"Detail":{"type":"string","nullable":true},"Instance":{"type":"string","nullable":true}},"additionalProperties":{}}}},"paths":{"/v1/workflows":{"post":{"tags":["Workflows"],"summary":"Create a workflow","requestBody":{"description":"Workflow to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowModel"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"string","format":"uuid"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"}}}}}}}}}
```

## PUT /v1/workflows

> Update a workflow

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Workflows","description":""}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}},"schemas":{"Struct.App.Api.Models.Workflow.WorkflowUpdateModel":{"type":"object","properties":{"MoveEntitiesFromStateUidToStateUid":{"type":"object","additionalProperties":{"type":"string","format":"uuid"},"description":"Move entities from state uid to another state uid when e.g. deleting a state","nullable":true},"Uid":{"type":"string","description":"Unique id of workflow","format":"uuid"},"Alias":{"type":"string","description":"Alias of the workflow","nullable":true},"Label":{"type":"string","description":"Label of the workflow","nullable":true},"DefaultStateUid":{"type":"string","description":"The default state of the workflow","format":"uuid"},"States":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowStateModel"},"description":"The states of the workflow","nullable":true},"ProductAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to products using the product structures","nullable":true},"VariantAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to variants using the product structures","nullable":true},"CatalogueAssignmentCatalogueUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to categories in the catalogues","nullable":true},"AssetAssignmentAssetTypeUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to asset types","nullable":true},"VariantGroupAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to variant groups using the product structures","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow"},"Struct.App.Api.Models.Workflow.WorkflowStateModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow state","format":"uuid"},"Alias":{"type":"string","description":"Alias of the workflow state","nullable":true},"Label":{"type":"string","description":"Label of the workflow state","nullable":true},"Transitions":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowTransitionModel"},"description":"The transitions of the workflow","nullable":true},"Color":{"type":"string","description":"The color of the state in the UI","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow state"},"Struct.App.Api.Models.Workflow.WorkflowTransitionModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow transition","format":"uuid"},"TransitionToStateUid":{"type":"string","description":"The state it can transition to","format":"uuid"},"Label":{"type":"string","description":"Label of the workflow transition","nullable":true},"Description":{"type":"string","description":"Description of the workflow transition","nullable":true},"RequiredPermission":{"type":"string","description":"The required permission to use the transition","format":"uuid","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow transition"},"Microsoft.AspNetCore.Mvc.ProblemDetails":{"type":"object","properties":{"Type":{"type":"string","nullable":true},"Title":{"type":"string","nullable":true},"Status":{"type":"integer","format":"int32","nullable":true},"Detail":{"type":"string","nullable":true},"Instance":{"type":"string","nullable":true}},"additionalProperties":{}}}},"paths":{"/v1/workflows":{"put":{"tags":["Workflows"],"summary":"Update a workflow","requestBody":{"description":"Updated workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowUpdateModel"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"string","format":"uuid"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"}}}}}}}}}
```

## GET /v1/workflows/{uid}

> Get a workflow

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Workflows","description":""}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}},"schemas":{"Struct.App.Api.Models.Workflow.WorkflowModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow","format":"uuid"},"Alias":{"type":"string","description":"Alias of the workflow","nullable":true},"Label":{"type":"string","description":"Label of the workflow","nullable":true},"DefaultStateUid":{"type":"string","description":"The default state of the workflow","format":"uuid"},"States":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowStateModel"},"description":"The states of the workflow","nullable":true},"ProductAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to products using the product structures","nullable":true},"VariantAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to variants using the product structures","nullable":true},"CatalogueAssignmentCatalogueUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to categories in the catalogues","nullable":true},"AssetAssignmentAssetTypeUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to asset types","nullable":true},"VariantGroupAssignmentProductStructureUids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Assignment of the workflow to variant groups using the product structures","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow"},"Struct.App.Api.Models.Workflow.WorkflowStateModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow state","format":"uuid"},"Alias":{"type":"string","description":"Alias of the workflow state","nullable":true},"Label":{"type":"string","description":"Label of the workflow state","nullable":true},"Transitions":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowTransitionModel"},"description":"The transitions of the workflow","nullable":true},"Color":{"type":"string","description":"The color of the state in the UI","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow state"},"Struct.App.Api.Models.Workflow.WorkflowTransitionModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of workflow transition","format":"uuid"},"TransitionToStateUid":{"type":"string","description":"The state it can transition to","format":"uuid"},"Label":{"type":"string","description":"Label of the workflow transition","nullable":true},"Description":{"type":"string","description":"Description of the workflow transition","nullable":true},"RequiredPermission":{"type":"string","description":"The required permission to use the transition","format":"uuid","nullable":true}},"additionalProperties":false,"description":"Model used to create a new workflow transition"}}},"paths":{"/v1/workflows/{uid}":{"get":{"tags":["Workflows"],"summary":"Get a workflow","parameters":[{"name":"uid","in":"path","description":"Id of workflow to get","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowModel"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Struct.App.Api.Models.Workflow.WorkflowModel"}}}}}}}}}
```

## DELETE /v1/workflows/{uid}

> Delete a workflow

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Workflows","description":""}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}}},"paths":{"/v1/workflows/{uid}":{"delete":{"tags":["Workflows"],"summary":"Delete a workflow","parameters":[{"name":"uid","in":"path","description":"Id of workflow to delete","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}}}}}}
```
