Find below an overview on these attributes and what combinations make sense. Location | Direction | Attribute | Description |
---|
Service
| Request
| Accepted Request Content Type | Define which content types the endpoint accepts. | Reject Other Request Content Types | Define if other content types should be rejected with HTTP 406 (Not Acceptable). | Response
| Blob Body Content Type | Define which content types the endpoint can return to the client. | Reject Other Response Content Type | Define if the service should reject the request with HTTP 415 (Unsupported Media Type) if the client request has divergent accept headers. | Adapter | Info |
---|
You can only change the settings for adapter calls once you have copied the REST interface from the connector to your own service implementation - or if you have defined it manually from the beginning. |
| Request | Blob Body Accepted Request Content Type | Specify | which a list of content | type you are sending with your requesttypes you accept as a response. The Runtime generates a matching " | Content-TypeAccept" header to your request. | Reject Other | Response Request Content | TypeTypes | Specifies if the REST adapter should reject calls to this endpoint if a request uses a custom content type that does not match the content types listed in | Blob Body Accepted Request Content Type . This can be the case if you set the | content-type accept header manually. If set to true, and the | content-type accept header does not match, the adapter does not contact the endpoint at all but rejects calls with an exception ( | Request content type not declared as accepted by the service Set "accept" header does not accept any of declared response content types ). | Response
| Accepted Request Blob Body Content Type | Specify | a list of which content | types you accept as a responsetype you are sending with your request. The Runtime generates a matching " | AcceptContent-Type" header to your request. | Reject Other | Request Response Content | TypesType | Specifies if the REST adapter should reject calls to this endpoint if a request uses a custom content type that does not match the content types listed in | Accepted Request Blob Body Content Type. This can be the case if you set the | accept content-type header manually. If set to true, and the | accept content-type header does not match, the adapter does not contact the endpoint at all but rejects calls with an exception ( | Set "accept" header does not accept any of declared response content types Request content type not declared as accepted by the service ).
| ExamplesThe RESTAPI_BlobContent_Example and the RESTAdapter_BlobContent_Example implement a server and a client that exchange blob content (pictures). They have the following blob content setup implemented: 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 Accepted Request Content Type | image/png | The client sends PNGs. | Retrieve a picture | GET /picture/<an id> | Accepted Request Blob Body Content Type | image/png;image/jpeg | The client accepts PNGs and JPGs as a response. | Good CasesThe 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 CasesThe 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) | |