K2 REST Service Broker does not retrieve data for any Response Code other than 200

  • 16 February 2021
  • 0 replies
  • 130 views

Userlevel 5
Badge +20
 

K2 REST Service Broker does not retrieve data for Response Codes other than 200

kbt153132

PRODUCT
K2 Five
BASED ON
K2 Five (all)
TAGS
Security
Service Broker
This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.

Issue

The K2 REST Service Broker does not retrieve data for any Response Codes other than 200. I.e. if a client uses a web service which fails, it needs to return an error message (such as a HTTP return code 400) to display to the end user.

You will be presented with a Blank "String" value when the Deserialize method is executed. You will not get a 400 response string if this is a bad request.

Image

Symptoms

The customer will not be able to execute the Method correctly and will receive no information.

Troubleshooting tip
Update the service instance key: "Break on error" to TRUE

Image

 

Resolution

 

The swaggers.json post method response will need to be changed to only expect a string, not a string array:

"responses": {
          "200": {
            "description": "OK",
            "schema": {
                "type": "string"             
            }
          }
        },

K2 returns a response of 200 for successful requests:

Image

And the error code for unsuccessful requests is returned:

Image

Currently (4.7 - 5.2) we only create the ServiceObject methods return properties from the code 200 response and for other cases where the errorCode object matches the valid response object it is not implemented (only the error code is returned).

Please note that a feature request has been logged on the ideas portal to extend this functionality: https://ideas.k2.com/ideas/APIT-I-449

You can also refer to the following documentation concerning K2 REST Service broker:

0 replies

Be the first to reply!

Reply