API Express service tests OK but doesn't receive data when used

Moderator: Support

Simon586
Posts: 11
Joined: Sun Aug 16, 2020 8:22 am

API Express service tests OK but doesn't receive data when used

Post by Simon586 »

Hi,

I've set up an API Express project, tested it and it's all good. Works lovely and returns values from the RESTAPI built in to it.

I've imported the service into my app and tested it and all looks good...it's returning data when I test it (on the TEST section of the SERVICE) that looks like this in the test window....

[{
"CHEMICAL_SUBSTANCE": "SubstanceA"
}, {
"CHEMICAL_SUBSTANCE": "SubstanceB"
}, {
"CHEMICAL_SUBSTANCE": "SubstanceC"
}, {.........etc

it returns a few hundred results as it should.

All good so far.

When I call the service in the app and pass the correct parameter (I've checked that the parameter is being passed correctly by logging it in the console then pasting it into the test section of the service with success) then it does not return ANY data. Just an empty array.

I'm running the following on the Success event of the service:

console.log("DataLength: " + data.length);
Apperyio.storage.MedList.set(data);

but data length is coming out as "0" and the storage variable (which is set up in the Model as the same structure as the response) is just an empty array.

Any ideas?

Simon

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

Re: API Express service tests OK but doesn't receive data when used

Post by Serhii Kulibaba »

Hello Simin,

Could you please check the Network tab of your browser? Do you see a correct response here? Where did you see a full response? Please provide us with some screenshots of these pages

Simon586
Posts: 11
Joined: Sun Aug 16, 2020 8:22 am

Re: API Express service tests OK but doesn't receive data when used

Post by Simon586 »

Sorry about the delay Serhii,

Looking at the Network tab solved this as I could see the parameter wasn't being passed correctly.

Thanks for your help as always.

Simon

Post Reply