Rest service returns results as a string instead of json

  • 16 February 2021
  • 0 replies
  • 25 views

Issue

When generating a Swagger Descriptor for REST-based Services using RESTUnited.com and the accept header on the request is not text/plain, the response from the Rest API may return the results as a string value instead of the expected Json. This will cause the SmartObject of the rest service to present an error.

 

Error Code

"Error","SmartObjects","10702","Error","SourceCode.SmartObjects.ServiceBroker [ExecuteSmartObject]","10702 An error occurred in the K2_Management Service Instance. System.Exception: Service: [Service Name]
Service Guid: ef2dd87a-eaf3-42c4-bac1-e8a0312defd3
Severity: Error
Error Message: Encountered a problem calling REST service. (Inner: Error converting value......
InnerException Message: at SourceCode.SmartObjects.Services.K2Management.SmartObjects.Client.ManagementService.ExecuteSmartObjectWithResultCount(Guid SmartObjectGuid, String MethodName, SmartProperty[] InputProperties)","anonymous","0.0.0.0","[K2 Server name]:C:Program FilesK2Host ServerBin","867777006","1844a6751cc6472798aaa7b9ad574ed7",""

Resolution

You need to change the accept header on the request to text/plain. This will return the results of the API as the expected json. 

Additional Information

-  This was discovered in K2 Five (5.3).

- This issue occurred only on Get methods from the swagger that had an array/s.

Related Links


0 replies

Be the first to reply!

Reply