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
Another issue Attribute1 is dynamic so it is not matching with the Name in JSON. you need to use OnAfterResponse to covert this in to a fixed key. or ask api provider to send a fix key.
https://www.outsystems.com/forums/discussion/86704/deserialize-json-with-dynamic-key-from-rest-api/
https://medium.com/@jsmarques13/integrating-dynamic-structures-with-outsystems-6c45e36a4d47
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?
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
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
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
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
Hi the solution is working ? if you have any other issue let me know. I am happy to solve it.
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.
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?
can you share EAN for which you are not getting data ?
I checked it with following data and it is working
method=getInventoryProductsList¶meters={"inventory_id":37118,"filter_ean":""}
method=getInventoryProductsList¶meters={"inventory_id":37118,"filter_ean":658606139206 }
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.
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
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
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
Thank you @Dorine Boudry