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 manually created REST interfaces. You cannot change REST operations that have been imported to a connector. |
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 | Blob Body Content Type | image/png | The client sends PNGs. |
Retrieve a picture | GET /picture/<an id> | Accepted Request 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.
Client | Custom Header | Server | |||
---|---|---|---|---|---|
1 | Store a picture, wrong content type | POST /picture | Content-Type: image/svg+xml | → | accepts request |
handles wrong content type internally | |||||
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 |
← | HTTP 406 (not acceptable) | ||||
3 | Retrieve a picture, wrong content type | GET /picture/123456 | Accept: image/svg+xml | → | accepts request |
handles wrong content type internally | |||||
4 | Retrieve a picture, wrong content type, server rejects other content types | GET /picture/123456 | Accept: image/svg+xml | → | Reject Other Response Content Type = true |
← | HTTP 415 (Unsupported Media Type) |
Otp | ||
---|---|---|
|
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
| ||||||
Otp | ||||||
|
Rp | ||||
---|---|---|---|---|
|