API custom htttp codes

In API instead of

dmx-on:success=""

how do i mention specific codes like 210. The api has very non standard codes that i want to handle differently based on integer eg want to handle 210 differently from 220 etc even though they are both success

This may help

1 Like

Helpful post,it mentions using serverconnect.status . For me i think it will be lasterror.status? But what does lasterror mean? Does it only show status, message and response for error or does it show them on success too?

Not at computer but I believe they should be available for all responses.

1 Like

My API is working correctly in Postman. When i run it from wappler , at the database side side everything works well. In Website/ Wappler -The done event fires on completion of API. However the lasterror.status =0 instead of 200, the lasterror.message= Failed to execute. What could the reason be ? Is lasterror only available for error statuses?

lasterror.status =0 , the lasterror.message= Failed to execute. for both 200 and 400 response

Just saw this in the dev tools browser console does this have to do with the above

“failed to execute” Access to XMLHttpRequest at 'https://xxxx.azurewebsites.net/api/SignUpIn?emailid=xxxx%40gmail.com&pwd=HellwoWorld&preferredlanguage=en&issignin=0&isemailconsent=true&isupdate=0inputEmail=xxxgmail.com&inputPassword=HellwoWorld&=en&checkboxEmailConsent=&=' from origin 'http://localhost:60813' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.


Edited to add: this error is gone from the console after allowing this origin on Azure Functions. However , now the done event is not firing at all ( although the API is hitting Azure and otherwise working correctly. The API is also working correctly in Postman

Will make a separate question for my problems with inability to get API response , message and status and once i am able to use APIs correctly will come back to custom status codes

Lasterror seems to only run if the api does not run. api1.status can be used to access the status code