Skip to main content

when Rest API smartObject executed, in response it is returning back blank values with code=0

  • 4 November 2022
  • 3 replies
  • 13 views

when Rest API smartObject executed, in response it is returning back blank values.

and the response code is 0.

 

I have also tried with openweather API it shows same result.

 

PFA screen shot.

 

When I tested Rest API and the JSON descriptor document also in POSTMAN client, Response code is 200. test is successful.

 

but not able to understand from k2 why it does not returning expected result.

Guys, Kindly let me know how to resolve it.

I will really greatfull for your technical help.

Hi there,



 



When you make the call in POSTMAN, do you have any default headers set against the request being made?



 



If so you'll need to also pass them through on the request.  You can on the service instance set the value of Add HTTP Request Header Property To Methods to true, this will then allow you to pass in serialised HTTP Header values to the request, or if they are always the same you can set them against the service instance in the Default HTTP Request Headers value. 



 



The below example is serialised from the HttpHeaders SmartObject Serialise add item to Array method and sets the Accept header to application/json;odata=verbose, which can then be added to either of the above places:



 



{"$type":"SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeader[], SourceCode.SmartObjects.Services.Endpoints.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null","$values":[{"$type":"SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeader, SourceCode.SmartObjects.Services.Endpoints.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null","Name":"Accept","Value":"application/json;odata=verbose"}]}



 



Cheers


thanks Scout.

Another possible cause may be the response section of your swagger file:



https://help.nintex.com/en-US/k2five/userguide/current/default.htm#ServiceBrokers/EndPoints/REST_SwaggerFileReferenceFormat.htm





Do you have a response definition for 200? If it is a complex response, do you have a ref and a definition defined?


Reply