SmartObject REST Services

This content applies to legacy components (such as K2 Studio and K2 for Visual Studio), legacy assemblies, legacy services or legacy functionality. If you have upgraded from K2 blackpearl 4.7 to K2 Five, these items may still be available in your environment. These legacy items may not be available in new installations of K2 Five. These legacy items may also not be available, supported, or behave as described, in future updates or versions of K2. Please see the legacy component support policy for more information about support for these components.

SmartObject REST Services provide RESTful web services (REST) endpoints for SmartObjects on a K2 Server, based on the configuration of the K2 server to expose certain SmartObjects' methods as REST services (see Configuring SmartObject REST and WCF Services

The RESTful services support XML, ATOM and JSON output formats, and you can specify which format you want returned with a query string options appended to the service endpoint.

Service Endpoints

K2 SmartObject Services REST endpoints provide standard URIs (Uniform Resource Identifiers) for interacting with the available SmartObjects data and operations. 

You can determine the available URIs for a K2 environment by navigating to the endpoints.xml URL:
{Scheme}{Server}:{Port}{Service Root}/endpoints/endpoints.xml
example, if opening the endpoints.xml URL on the K2 server itself:
https://localhost:8888/SmartObjectServices/endpoints/endpoints.xml

You should see a listing of available endpoints, similar to the screenshot extract below:

For more information on how the URIs are structured and explanation of the query options, please see URIs for REST Services

SmartObject Method Types  

Each of the standard SmartObject method types are available as REST endpoints. Please see the topics listed below for more information on how the method types are exposed and called.

Errors and Response Codes

The SmartObjects Services uses the following standard HTTP status codes.   

  • 200 (OK) – returned if the call was successful
  • 400 (Bad Request) – returned if the Request Body was not correctly formatted
  • 404 (Not Found) – returned if something requested is no longer available
  • 405 (Method Not Allowed) – returned if the method is not allowed for the SmartObject
  • 503 (Service Unavailable) – returned if the K2 Server was unreachable
  • 500 (Server Error) – returned if any other error occurred
Different languages and platforms handle HTTP status codes differently. Ensure that sufficient error handling is present for these status codes.