HTTP 404 when accessing SmartObject OData API

  • 26 March 2019
  • 6 replies
  • 126 views

Hi

 

When enabling the SmartObject OData API in K2 Five Management, i get a errorbox telling me "Could not refresh services, try again?".

When i look at the entire message returned, it's actually a HTTP 404 return message.

 

I checked the psysical path on the IIS, where the OData endpoint is locatet, and that looks fine to me.

The K2 Service Account is also the one, running the K2 app pool on the IIS.

 

Im pretty stuck on now to get the OData endpoint working.

 

Any help would be appreciated.


6 replies

Hi BjarkeGr,

 

This issue seems to be very common especially to environments that have just been upgraded to K2 Five. The workaround is to refresh the SmartObject OData via https://{k2forms}/api/odata/op/refresh url, howevever you might encounter the same error in the future and would have to do the same refresh.

 

Having said the above, and possibly for a permanent fix, could you try to run the script against your K2 database to see if you possibly have duplicate smartobjects exposed to your OData Api which could be the reason for the error message.

To achieve this, In your SQL Server Management Studio RIGHT CLICK "K2" database -> SELECT "New Query" -> copy&paste the script -> CLICK "Execute". And then observe the results. 

 

------------------------------------------------------- Script -------------------------------------------------------

SELECT [SmartObjectGUID] ,[Version] ,COUNT(*) AS [DuplicatesCount]

FROM [SmartBroker].[SmartObject]

GROUP BY [SmartObjectGUID] ,[Version]

HAVING COUNT(*) > 1

--------------------------------------------------------End Of Script -------------------------------------------------

 

If the results of the script returns duplicate SmartObjects, then it is advisable to log a K2 support ticket from which you will get help on how to properly remove the duplicate SmartObjects exposed to OData Api.

 

Please note that the script provided does not modify the database in any way and it is only for the purpose of querying the DB for information.

 

Should this post be useful in resolving the issue, please mark it as such by "accept as solution" or "kudo" as it will be of help to other members of the community that experiance a similar issue.

 

Thanks,

Katleho

 

K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member.

Hi Katlehon

 

When trying to refresh the SmartObject Odata, as you described - i get the same 404. It's like the entire /Odata is broken in some way.

 

I just ran your SQL script, to check for duplicates in the database - the results where none, so there is not any SmartObject duplicates.

 

The installation is only i couple of weeks old, so we did not upgrade from an older version - we only installed the newest fixpack, 2 weeks ago.

This issue has been solved.

It was solved through changing the .NET-Globalization setting (IIS settings for the API site).

Hope that helps someone in the future.

 

-Palle

Hello,

Please can you specify which setting was changed?

Where is this setting located and what should be the desired value?

Thank you!

Hi  Kanwarnitin,
 
For the .Net globalization settings, do the following;
IIS Manager > Sites > K2 > Api > odata > .NET Globalization and selecting "English (United States) (en-US)" for Culture and UI Culture properties and clicking on Apply.
 
Let us know of the outcome of this as well.
 
Regards,
Katleho
Thank you Katleho, this resolved the issue.

Reply