35
Views
15
Comments
Solved
Rest API Response 200 but no output
Question
Service Studio Version
11.55.9 (Build 63976)

I am using baselinker API (https://api.baselinker.com/index.php?method=getInventoryProductsList) and have it setup in outsystems, when I set it up using filter_ean and copy response to body only that EAN I used during the test works and receives a response but as soon as I use another EAN I get a 200 SUCCESS response but no data.

I have contacted baselinker and they do not log api calls but they can see that the request is being received and response sent. I have also tried using postman and have no issues on there.

The only way I can replicate it on postman is by missing a digit off the EAN so to try and test if any digits are being missed, I have created a database with the EANs and product id in so when the EAN is entered into text input it then finds that item and uses the full EAN in the table, I have also tried filtering with id from the same table but the same thing happens.

I have checked that the json is being passed correcly in the body and it appears that it is and have also tried adding another header Accept-Encoding with " * " as suggested in other posts but still nothing.

It is weird how only the EAN used in the test and setup of the API in outsystems is the only one that works but as soon as you try a different one you get nothing.

Any help with this would be really appreciated


Screenshot 2025-02-19 133916.png
2025-02-19 13-35-47.mp4
2022-12-30 07-28-09
Navneet Garg
Solution
UserImage.jpg
Connor Eaton

Ah, I think you may have found it as when I run it in postman this number does change depending on product EAN. 

I had a look at OnAfterResponse but was struggling to get it to work (sorry I am fairly new to this side of OutSystems). How should I set it up to get this to work?

2022-12-30 07-28-09
Navneet Garg

yes I can understand OutSytems is strongly typed there due to nature of json it is very hard to manage it.

Can your API provider can easily change the node to fixed attribute. It is the easiest solution for you. 

Other than that meanwhile I'll try to give you solution for dynamic json 

UserImage.jpg
Connor Eaton

so from looking at it it appears the attribute number is the same as the product ID which is autoset in the inventory management side by the provider so because of this I dont think they would be able to make it fixed

2022-12-30 07-28-09
Navneet Garg
Solution

Please check the solution here. I tested all three ids given by you. Let me know if any thing is missing.

https://personal-u1aragiz.outsystemscloud.com/VitaleuxLabelChanger/UpdateTag


Please note that now json reponse is something like following :

{"status":"SUCCESS","products":[{"key":"176314794","value":{"id":176314794,"ean":"658606139213","sku":"VIT-FRA-100-28-002","name":"No. 28 Eau De Parfum","stock":{"bl_58839":7},"prices":{"32486":20}}}]} 

products is now an array so when you use it either use Current or index or iterate it depending on your needs

PostConnector.Response.Products.Current.Value.Name

VitaleuxLabelChanger_Solution.oml
UserImage.jpg
Connor Eaton

Yep that appears to now be working perfectly and can see that the respone is now an array. Just had a quick look and test and appears that everything is working as should.

Thank you very much for this, im on my third day of trying to work out what was happening and never noticed that

2022-12-30 07-28-09
Navneet Garg

Hi the solution is working ? if you have any other issue let me know. I am happy to solve it.

UserImage.jpg
Chiranjeevi Balaji

Hi @Connor Eaton 

Could you please share your OML? It would help me understand and resolve the issue more quickly. 

Please provide some sample data along with it, if possible. 

UserImage.jpg
Connor Eaton

Here is the OML.

In regards to sample data are you after a couple EANs to try or the response data that I should be getting?

VitaleuxLabelChanger.oml
2022-12-30 07-28-09
Navneet Garg

can you share EAN for which you are not getting data ?

I checked it with following data and it is working

method=getInventoryProductsList&parameters={"inventory_id":37118,"filter_ean":""}

method=getInventoryProductsList&parameters={"inventory_id":37118,"filter_ean":658606139206 }

UserImage.jpg
Connor Eaton

So only one EAN works which is: 658606139206

No other EANs work for example: 658606139213, 658606139282

Sorry I have also checked and I had changed something in the first OML for testing - here is the actual version.

VitaleuxLabelChanger.oml
2022-12-30 07-28-09
Navneet Garg

I think I understood the issue. Look at the json filter_id and filter_ean 

{"inventory_id":37118,"filter_id":"658606139206"} 

 {"inventory_id":37118,"filter_ean":658606139206}

update your structure and test it again

 

UserImage.jpg
Connor Eaton

Sorry yes I have just noticed this, I had changed this to test filtering by id not ean but have just updated the OML to be how it should

2022-12-30 07-28-09
Navneet Garg
Solution
UserImage.jpg
Connor Eaton

Ah, I think you may have found it as when I run it in postman this number does change depending on product EAN. 

I had a look at OnAfterResponse but was struggling to get it to work (sorry I am fairly new to this side of OutSystems). How should I set it up to get this to work?

2022-12-30 07-28-09
Navneet Garg

yes I can understand OutSytems is strongly typed there due to nature of json it is very hard to manage it.

Can your API provider can easily change the node to fixed attribute. It is the easiest solution for you. 

Other than that meanwhile I'll try to give you solution for dynamic json 

UserImage.jpg
Connor Eaton

so from looking at it it appears the attribute number is the same as the product ID which is autoset in the inventory management side by the provider so because of this I dont think they would be able to make it fixed

2022-12-30 07-28-09
Navneet Garg
Solution

Please check the solution here. I tested all three ids given by you. Let me know if any thing is missing.

https://personal-u1aragiz.outsystemscloud.com/VitaleuxLabelChanger/UpdateTag


Please note that now json reponse is something like following :

{"status":"SUCCESS","products":[{"key":"176314794","value":{"id":176314794,"ean":"658606139213","sku":"VIT-FRA-100-28-002","name":"No. 28 Eau De Parfum","stock":{"bl_58839":7},"prices":{"32486":20}}}]} 

products is now an array so when you use it either use Current or index or iterate it depending on your needs

PostConnector.Response.Products.Current.Value.Name

VitaleuxLabelChanger_Solution.oml
UserImage.jpg
Connor Eaton

Yep that appears to now be working perfectly and can see that the respone is now an array. Just had a quick look and test and appears that everything is working as should.

Thank you very much for this, im on my third day of trying to work out what was happening and never noticed that

2022-12-30 07-28-09
Navneet Garg

Hi the solution is working ? if you have any other issue let me know. I am happy to solve it.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Connor Eaton ,

it is a practice on this forum for the original poster to mark a response as solution (one or more) to indicate to all helpers that the problem is solved and needs no more help, but even more importantly to help future users of the forum quickly identify the most helpfull replies on any post.

I have taken the liberty to do it for you on this one.

Dorine 

2022-12-30 07-28-09
Navneet Garg

Thank you @Dorine Boudry 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.