Page 1 of 2

Control no data received in a rest api

Posted: Thu Jun 11, 2015 8:33 pm
by Kinson Sa

I'm using API Express and it works perfect.
But I have a lilte problem. I have some services that maybe it does not return any data.
In that case I try everything, JS in success:

if (data.leght===null) {
alert("No tiene depositos en este momento activos");
}

if (data.leght===0) {
alert("No tiene depositos en este momento activos");
}

Not working.

Do someone know how to solve this problem??

Thanks


Control no data received in a rest api

Posted: Fri Jun 12, 2015 9:54 am
by Serhii Kulibaba

Hello Kinson,

You use incorrect JS predata.leght/pre
please use this: predata.length/pre


Control no data received in a rest api

Posted: Fri Jun 12, 2015 2:43 pm
by Kinson Sa

Dear Sergiy,

Yes you are right, I copy it worg, but my code is ok.

It doen not work anyway.


Control no data received in a rest api

Posted: Sat Jun 13, 2015 9:09 pm
by Evgene Karachevtsev

Hello Kinson,

Could you please clarify do you get any errors in a browser console?


Control no data received in a rest api

Posted: Sun Jun 14, 2015 6:48 pm
by Kinson Sa

Yes, I make a rest call and I can get this respons

[
{
"letra":"2 ",
"fecha":"2015-01-28 00:00:00.0",
"cliente":"430000146",
"nombre":"FRANCISCO AÑO CHILLIDA ",
"numero":" 8",
"importe":538.2,
"vendedor":"21",
"comision":32.292
}
]

But maybe my response is like this:

{

}

If nothing, how I can tell to my repsell that I have nothing to show???

In that case, there is no error, but also not complette, not success. So I do not know how to cach this situation.


Control no data received in a rest api

Posted: Mon Jun 15, 2015 4:21 pm
by Serhii Kulibaba

Could you please provide more details, screen shots of network tab (response) would help.


Control no data received in a rest api

Posted: Tue Jun 16, 2015 1:08 pm
by Kinson Sa

Dear Sergiy,

You can see 2 images, the same call different response, as maybe there are no orders for this customers.

Image Image


Control no data received in a rest api

Posted: Tue Jun 16, 2015 1:08 pm
by Kinson Sa

I just want to know if it is possible to catch this situation in anyway??


Control no data received in a rest api

Posted: Sat Jun 20, 2015 6:03 pm
by Alena Prykhodko

Please show us screen shots Sergiy requested, this will help https://devcenter.appery.io/documenta...


Control no data received in a rest api

Posted: Wed Jun 24, 2015 9:18 am
by Kinson Sa

Dear Alena, Thanks I did not know it was possible to do that.

Here you can see console with the error. Image