Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
The Designer can handle blob parameters in the body of a REST interface . This for requests and responses. Blobs may contain different content types. How the content types should be handled can be configured on a REST operation client and server side by four attributes provided by stereotype REST Operation for REST APIs and REST adapters.
Info |
---|
This is only available for For REST adapters, you can change the options listed below on manually created REST interfaces. You cannot change REST operations that have been imported to a connector, or once you have copied your connector definitions to the API folder of your service. |
Excerpt | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Find below an overview on these attributes and what combinations make sense.
ExamplesGET Examples | |||||||||||||||||||||||||||||||
Nr | Location | Tag | Remark | ||||||||||||||||||||||||||||
1 | Service | accepts application/msexcel |
| ||||||||||||||||||||||||||||
Adapter | Accepted Request Content Type | - | |||||||||||||||||||||||||||||
Reject Other Request Content Types | - | ||||||||||||||||||||||||||||||
Header | accept: | msword | |||||||||||||||||||||||||||||
2 | Service | accepts application/msexcel |
| ||||||||||||||||||||||||||||
Adapter | Accepted Request Content Type | msexcel | |||||||||||||||||||||||||||||
Reject Other Request Content Types | true | ||||||||||||||||||||||||||||||
Header | accept: | msword | |||||||||||||||||||||||||||||
Nr | Location | Tag | Remark | ||||||||||||||||||||||||||||
1 | Service | accepts application/msexcel |
| ||||||||||||||||||||||||||||
Adapter | Blob Body Content Type | - | |||||||||||||||||||||||||||||
Reject Other Response Content Type | - | ||||||||||||||||||||||||||||||
Header | content-type: | msword | |||||||||||||||||||||||||||||
2 | Service | accepts application/msexcel |
| ||||||||||||||||||||||||||||
Adapter | Blob Body Content Type | application/msexcel | |||||||||||||||||||||||||||||
Reject Other Response Content Type | true | ||||||||||||||||||||||||||||||
Header | content-type: | msword |
Server (RESTAPI_BlobContent_Example) | Content Type Settings | Description | ||
---|---|---|---|---|
Store a picture | POST /picture | Accepted Request Content Type | image/png;image/jpeg | The server can store PNGs and JPGs. |
Return a picture by id | GET /picture/<an id> | Blob Body Content Type | image/png | The server returns PNGs upon request. |
Client (RESTAdapter_BlobContent_Example) | Content Type Settings | |||
Send a picture | POST /picture | Accepted Request Content Type | image/png | The client sends PNGs. |
Retrieve a picture | GET /picture/<an id> | Blob Body Content Type | image/png;image/jpeg | The client accepts PNGs and JPGs as a response. |
Good Cases
The following table shows some example calls and how they would be executed.
Client | Generated Header | Server | |||
---|---|---|---|---|---|
1 | Store a picture | POST /picture | Content-Type: image/png | → | accepts request |
← | returns id HTTP 201 | ||||
2 | Retrieve a picture | GET /picture/123456 | Accept: image/png | → | accepts request |
Content-Type: image/png | ← | returns picture PNG |
Error Cases
The following table shows some error cases and their consequences if you do not rely on the automatically generated headers but set your own headers instead.
Example | Client | Custom Header | Server | ||
---|---|---|---|---|---|
1 | Store a picture, wrong content type | POST /picture | Content-Type: image/svg+xml | → | accepts request |
| |||||
2 | Store a picture, wrong content type, server rejects other content types | POST /picture | Content-Type: image/svg+xml | → | Reject Other Request Content Types = true |
← |
| ||||
3 | Store a picture, wrong content type, client rejects other content types | POST /picture Reject Other Request Content Types = true | Content-Type: image/svg+xml | ↓ | not called at all |
| ← | ||||
4 | Retrieve a picture, wrong content type | GET /picture/123456 | Accept: image/svg+xml | → | accepts request |
| |||||
5 | Retrieve a picture, wrong content type, server rejects other content types | GET /picture/123456 | Accept: image/svg+xml | → | Reject Other Response Content Type = true |
← |
|
Panel | ||
---|---|---|
| ||
|
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
Panel | ||
---|---|---|
|
Otp | ||
---|---|---|
|
|