Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Mittels Scroll Versions veröffentlicht aus dem Bereich WDESIGNER und Version 23.1a.

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.

POST Examples

The 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:

Excerpt

Find below an overview on these attributes and what combinations make sense.

Specify
LocationDirectionAttributeDescription
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 Content Type

Specify which content type you are sending with your request. The Runtime generates a matching "Content-Type" header to your request requires.

Reject Other Response Content Type

Specifies if the REST adapter should reject calls to this endpoint

using

if a request uses a custom content type that does not match the content types listed in Blob Body Content Type.
This can be the case if you set the content-type header manually. If set to true, and the content-type 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).

Response

Accepted Request Content Type

Specify a list of content types the endpoint returnsyou accept as a response. The Runtime generates a matching "Accept" header to your request.

Reject Other Request Content Types

Specifies if the REST adapter should reject calls to this endpoint using if a request uses a custom content type that does not match the content types listed in Accepted Request Content Type .
This can be the case if you set the accept header manually. If set to true, and the accept 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).

Examples

GET Examples

NrLocationTagRemark
1Serviceaccepts application/msexcel
  • request performed
  • REST service may return error
Adapter

Accepted Request Content Type

-

Reject Other Request Content Types

-

Header

accept:

msword

2Serviceaccepts application/msexcel
  • request rejected by REST adapter
  • Exception: Set "accept" header does not accept any of declared response content types
Adapter

Accepted Request Content Type

msexcel

Reject Other Request Content Types

true

Header

accept:

msword

NrLocationTagRemark
1Serviceaccepts application/msexcel
  • request performed
  • REST service may return error
Adapter

Blob Body Content Type

-

Reject Other Response Content Type

-
Header

content-type:

msword
2Serviceaccepts application/msexcel
  • request rejected by REST adapter
  • Exception: RESTLM/48: Request content type not declared as accepted by the service
Adapter

Blob Body Content Type

application/msexcel

Reject Other Response Content Type

true
Header

content-type:

msword
Server (RESTAPI_BlobContent_Example)Content Type SettingsDescription
Store a picturePOST /pictureAccepted Request Content Typeimage/png;image/jpegThe server can store PNGs and JPGs.
Return a picture by idGET /picture/<an id>Blob Body Content Typeimage/pngThe server returns PNGs upon request.
Client (RESTAdapter_BlobContent_Example)Content Type Settings
Send a picturePOST /pictureBlob Body Content Typeimage/pngThe client sends PNGs.
Retrieve a pictureGET /picture/<an id>Accepted Request Content Typeimage/png;image/jpegThe client accepts PNGs and JPGs as a response.

Good Cases

The following table shows some example calls and how they would be executed.

ClientGenerated HeaderServer
1Store a picture

POST /pictureContent-Type: image/pngaccepts request


returns id
HTTP 201
2Retrieve a pictureGET /picture/123456Accept: image/pngaccepts request

Content-Type: image/pngreturns 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.

ClientCustom HeaderServer
1Store a picture, wrong content typePOST /pictureContent-Type: image/svg+xmlaccepts request



handles wrong content type internally
2Store a picture, wrong content type,
server rejects other content types


POST /pictureContent-Type: image/svg+xml

Reject Other Request Content Types = true



HTTP 406 (not acceptable)
3Retrieve a picture, wrong content type
GET /picture/123456Accept: image/svg+xmlaccepts request



handles wrong content type internally
4Retrieve a picture, wrong content type,
server rejects other content types


GET /picture/123456Accept: image/svg+xmlReject Other Response Content Type = true


HTTP 415 (Unsupported Media Type)

Otp
Floatingfalse

Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNameRESTAPI_BlobContent_Example
PageWithExcerptINTERNAL:_designer_examples

Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNameRESTAdapter_BlobContent_Example
PageWithExcerptINTERNAL:_designer_examples
Otp
Floatingfalse

Rp

Children Display
pageREST Adapter