OData for Nintex K2

Hi Skuid Community,

I’d like to use Nintex K2 OData V4 endpoint. For this most part this works great out of the box but that endpoint doesn’t determine which CRUD operation to perform solely from the HTTP verb. Rather, it requires a query string parameter too.

To call a K2 SmartObject Update method, I need to use HTTP PUT, and provide ?method=Save (K2 SmartObjects may have multiple methods, update or otherwise, with varying names).

Without having to create a wrapper web-service/middleware, is there something I can do in Skuid itself to workaround this?

Many thanks!

2 Likes

I’ve created a (partial) workaround but would be interested to hear best/better practices.

When the New Request page loads, the OData DataSource uses the “Create default row if model has none” option. There is then an Action on “New row created in model”, which in turn runs the following JS Snippet:

var model = skuid.model.getModel(‘Request’);
model.dataSource.requestUrlParameters = { method: “Create” }

This works for the initial create, which is all I need from this page.

I believe this can be adapted to work for other CRUD methods too. I ruled out having separate datasources with fixed “Common URL Parameters” because that would mean for Tables, having to manage Updates, Deletes, and Creates via multiple models sharing data which seems harder.

1 Like

Were all impressed with your workaround.

Another suggestion - that might equally qualify as a workaround - would be to use our “REST” data source type instead of the “ODATA” one. Here you will have to configure the specific endpoints you want connected to each model - there is no Metadata query like you get with ODATA. But because you have complete control of the Verb’s URL - you can add whatever parameter you want to the URL associated with specific REST Methods. You can add a standard URL parameter that is sent with every REST call.

The URL property will also merge data - using the {{DoubleBraceSyntax}}. which allows you to inject dynamic values into your calls.

Again - this is pretty ugly - and misses a lot of the goodness that OData connections provide. But it lets you add the query string parameter.

Let us know if you have further questions. (And were glad to be joining Nintex!)

2 Likes