Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Control no data received in a rest api

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

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Control no data received in a rest api

Hello Kinson,

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

Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Control no data received in a rest api

Dear Sergiy,

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

It doen not work anyway.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Control no data received in a rest api

Hello Kinson,

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

Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Control no data received in a rest api

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.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Control no data received in a rest api

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

Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Control no data received in a rest api

Dear Sergiy,

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

Image Image

Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Control no data received in a rest api

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Control no data received in a rest api

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

Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Control no data received in a rest api

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

Here you can see console with the error. Image

Return to “Issues”