# Messaging

Azure service bus is used to implement a queue of system events that can be subscribed to by external systems.

## Get an Azure Service Bus connections

> \#Available from v.3.15.0

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Messaging","description":"Azure service bus is used to implement a queue of system events that can be subscribed to by external systems."}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}},"schemas":{"Struct.App.Api.Models.Messaging.MessageQueueModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of the message queue connection","format":"uuid"},"Title":{"type":"string","description":"Title of message queue connection","nullable":true},"ServiceBusConnectionString":{"type":"string","description":"Url for the message queue to request when triggered","nullable":true},"QueueName":{"type":"string","description":"Queue name for the message queue","nullable":true},"BlobContainerConnectionString":{"type":"string","description":"Url for the blob storage to request when triggered","nullable":true},"BlobContainerName":{"type":"string","description":"","nullable":true},"Active":{"type":"boolean","description":"Activate / deactivate message queue connection"},"EnabledEvents":{"type":"array","items":{"type":"string"},"description":"Events this message queue shall act on","nullable":true},"AdvancedSettings":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.EventSettings"},"description":"Advanced settings for events supporting this message queue","nullable":true}},"additionalProperties":false,"description":"Model representing a message queue connection"},"Struct.App.Api.Models.Messaging.EventSettings":{"type":"object","properties":{"EventSettingsType":{"type":"string","description":"Event settings type","nullable":true,"readOnly":true}},"additionalProperties":false,"description":"Event settings"},"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/azureservicebusconnections/{uid}":{"get":{"tags":["Messaging"],"summary":"Get an Azure Service Bus connections","description":"#Available from v.3.15.0","parameters":[{"name":"uid","in":"path","description":"Uid of Azure Service Bus connection","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.MessageQueueModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"}}}}}}}}}
```

## DELETE /v1/azureservicebusconnections/{uid}

> Delete an Azure Service Bus connection

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Messaging","description":"Azure service bus is used to implement a queue of system events that can be subscribed to by external systems."}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}}},"paths":{"/v1/azureservicebusconnections/{uid}":{"delete":{"tags":["Messaging"],"summary":"Delete an Azure Service Bus connection","parameters":[{"name":"uid","in":"path","description":"Uid of Azure Service Bus connection to delete","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}}}}}}
```

## GET /v1/azureservicebusconnections

> Get all Azure Service Bus connections

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Messaging","description":"Azure service bus is used to implement a queue of system events that can be subscribed to by external systems."}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}},"schemas":{"Struct.App.Api.Models.Messaging.MessageQueueModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of the message queue connection","format":"uuid"},"Title":{"type":"string","description":"Title of message queue connection","nullable":true},"ServiceBusConnectionString":{"type":"string","description":"Url for the message queue to request when triggered","nullable":true},"QueueName":{"type":"string","description":"Queue name for the message queue","nullable":true},"BlobContainerConnectionString":{"type":"string","description":"Url for the blob storage to request when triggered","nullable":true},"BlobContainerName":{"type":"string","description":"","nullable":true},"Active":{"type":"boolean","description":"Activate / deactivate message queue connection"},"EnabledEvents":{"type":"array","items":{"type":"string"},"description":"Events this message queue shall act on","nullable":true},"AdvancedSettings":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.EventSettings"},"description":"Advanced settings for events supporting this message queue","nullable":true}},"additionalProperties":false,"description":"Model representing a message queue connection"},"Struct.App.Api.Models.Messaging.EventSettings":{"type":"object","properties":{"EventSettingsType":{"type":"string","description":"Event settings type","nullable":true,"readOnly":true}},"additionalProperties":false,"description":"Event settings"}}},"paths":{"/v1/azureservicebusconnections":{"get":{"tags":["Messaging"],"summary":"Get all Azure Service Bus connections","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.MessageQueueModel"}}}}}}}}}}
```

## POST /v1/azureservicebusconnections

> Create a new Azure Service Bus connection

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Messaging","description":"Azure service bus is used to implement a queue of system events that can be subscribed to by external systems."}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}},"schemas":{"Struct.App.Api.Models.Messaging.MessageQueueModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of the message queue connection","format":"uuid"},"Title":{"type":"string","description":"Title of message queue connection","nullable":true},"ServiceBusConnectionString":{"type":"string","description":"Url for the message queue to request when triggered","nullable":true},"QueueName":{"type":"string","description":"Queue name for the message queue","nullable":true},"BlobContainerConnectionString":{"type":"string","description":"Url for the blob storage to request when triggered","nullable":true},"BlobContainerName":{"type":"string","description":"","nullable":true},"Active":{"type":"boolean","description":"Activate / deactivate message queue connection"},"EnabledEvents":{"type":"array","items":{"type":"string"},"description":"Events this message queue shall act on","nullable":true},"AdvancedSettings":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.EventSettings"},"description":"Advanced settings for events supporting this message queue","nullable":true}},"additionalProperties":false,"description":"Model representing a message queue connection"},"Struct.App.Api.Models.Messaging.EventSettings":{"type":"object","properties":{"EventSettingsType":{"type":"string","description":"Event settings type","nullable":true,"readOnly":true}},"additionalProperties":false,"description":"Event settings"}}},"paths":{"/v1/azureservicebusconnections":{"post":{"tags":["Messaging"],"summary":"Create a new Azure Service Bus connection","requestBody":{"description":"Azure Service Bus connection to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.MessageQueueModel"}}}},"responses":{"200":{"description":"OK"}}}}}}
```

## PUT /v1/azureservicebusconnections

> Update an Azure Service Bus connection

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Messaging","description":"Azure service bus is used to implement a queue of system events that can be subscribed to by external systems."}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}},"schemas":{"Struct.App.Api.Models.Messaging.MessageQueueModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of the message queue connection","format":"uuid"},"Title":{"type":"string","description":"Title of message queue connection","nullable":true},"ServiceBusConnectionString":{"type":"string","description":"Url for the message queue to request when triggered","nullable":true},"QueueName":{"type":"string","description":"Queue name for the message queue","nullable":true},"BlobContainerConnectionString":{"type":"string","description":"Url for the blob storage to request when triggered","nullable":true},"BlobContainerName":{"type":"string","description":"","nullable":true},"Active":{"type":"boolean","description":"Activate / deactivate message queue connection"},"EnabledEvents":{"type":"array","items":{"type":"string"},"description":"Events this message queue shall act on","nullable":true},"AdvancedSettings":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.EventSettings"},"description":"Advanced settings for events supporting this message queue","nullable":true}},"additionalProperties":false,"description":"Model representing a message queue connection"},"Struct.App.Api.Models.Messaging.EventSettings":{"type":"object","properties":{"EventSettingsType":{"type":"string","description":"Event settings type","nullable":true,"readOnly":true}},"additionalProperties":false,"description":"Event settings"}}},"paths":{"/v1/azureservicebusconnections":{"put":{"tags":["Messaging"],"summary":"Update an Azure Service Bus connection","requestBody":{"description":"Azure Service Bus connection to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.MessageQueueModel"}}}},"responses":{"200":{"description":"OK"}}}}}}
```

## GET /v1/azureservicebusconnections/{connectionUid}/messages

> Get messages sent to the service bus. Note that messages is only stored for 14 days

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Messaging","description":"Azure service bus is used to implement a queue of system events that can be subscribed to by external systems."}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}},"schemas":{"Struct.App.Api.Models.Messaging.MessageSearchResult":{"type":"object","properties":{"Messages":{"type":"array","items":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.MessageModel"},"description":"Messages that matched the criteria","nullable":true},"Page":{"type":"integer","description":"Page of the search request","format":"int32"},"TotalHits":{"type":"integer","description":"Total number of hits in the search","format":"int32"}},"additionalProperties":false,"description":"Model containing response from a message search"},"Struct.App.Api.Models.Messaging.MessageModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of this message","format":"uuid"},"ConnectionUid":{"type":"string","description":"Unique id of the connection that triggered the message","format":"uuid"},"EventKey":{"type":"string","description":"The key of the event that triggered the event","nullable":true},"EventTimestamp":{"type":"string","description":"Timestamp of the event that triggered the message","format":"date-time"},"RequestTimestamp":{"type":"string","description":"Timestamp of when the message was made","format":"date-time"},"MessageBody":{"type":"string","description":"The message body sent in the message","nullable":true},"ElapsedMilliseconds":{"type":"integer","description":"The time in ms it took to get a response from the recipient of the request","format":"int64"},"RequestMetadata":{"type":"string","description":"Metadata about sending the message","nullable":true},"Status":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.ServiceBusMessageStatus"},"ParentServiceBusMessageUid":{"type":"string","description":"Uid of parent message (only has value, if this is a retry of a failed message)","format":"uuid","nullable":true},"IsRetry":{"type":"boolean","description":"Indicates whether this request is a retry of a previously failed request","readOnly":true}},"additionalProperties":false,"description":"Model representing a message"},"Struct.App.Api.Models.Messaging.ServiceBusMessageStatus":{"enum":[1,2],"type":"integer","description":"Status of sending the message \n\n- `1` = **Success**: Success\n- `2` = **Failed**: Failed","format":"int32"}}},"paths":{"/v1/azureservicebusconnections/{connectionUid}/messages":{"get":{"tags":["Messaging"],"summary":"Get messages sent to the service bus. Note that messages is only stored for 14 days","parameters":[{"name":"connectionUid","in":"path","description":"Uid of azure service bus connection","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"since","in":"query","description":"return messages newer than this timestamp","schema":{"type":"string","format":"date-time"}},{"name":"onlyFailed","in":"query","description":"Only return failed messages","schema":{"type":"boolean"}},{"name":"page","in":"query","description":"Page to get (1 is first page)","schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.MessageSearchResult"}}}}}}}}}
```

## GET /v1/azureservicebusconnections/{connectionUid}/messages/{messageUid}

> Get a specific message sent to the service bus. Note that messages are only stored for 14 days

```json
{"openapi":"3.0.1","info":{"title":"Struct PIM Public API","version":"1.0"},"tags":[{"name":"Messaging","description":"Azure service bus is used to implement a queue of system events that can be subscribed to by external systems."}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","description":"","name":"Authorization","in":"header"}},"schemas":{"Struct.App.Api.Models.Messaging.MessageModel":{"type":"object","properties":{"Uid":{"type":"string","description":"Unique id of this message","format":"uuid"},"ConnectionUid":{"type":"string","description":"Unique id of the connection that triggered the message","format":"uuid"},"EventKey":{"type":"string","description":"The key of the event that triggered the event","nullable":true},"EventTimestamp":{"type":"string","description":"Timestamp of the event that triggered the message","format":"date-time"},"RequestTimestamp":{"type":"string","description":"Timestamp of when the message was made","format":"date-time"},"MessageBody":{"type":"string","description":"The message body sent in the message","nullable":true},"ElapsedMilliseconds":{"type":"integer","description":"The time in ms it took to get a response from the recipient of the request","format":"int64"},"RequestMetadata":{"type":"string","description":"Metadata about sending the message","nullable":true},"Status":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.ServiceBusMessageStatus"},"ParentServiceBusMessageUid":{"type":"string","description":"Uid of parent message (only has value, if this is a retry of a failed message)","format":"uuid","nullable":true},"IsRetry":{"type":"boolean","description":"Indicates whether this request is a retry of a previously failed request","readOnly":true}},"additionalProperties":false,"description":"Model representing a message"},"Struct.App.Api.Models.Messaging.ServiceBusMessageStatus":{"enum":[1,2],"type":"integer","description":"Status of sending the message \n\n- `1` = **Success**: Success\n- `2` = **Failed**: Failed","format":"int32"}}},"paths":{"/v1/azureservicebusconnections/{connectionUid}/messages/{messageUid}":{"get":{"tags":["Messaging"],"summary":"Get a specific message sent to the service bus. Note that messages are only stored for 14 days","parameters":[{"name":"connectionUid","in":"path","description":"Uid of azure service bus connection","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"messageUid","in":"path","description":"Uid of the message","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Struct.App.Api.Models.Messaging.MessageModel"}}}}}}}}}
```
