68
Views
27
Comments
Solved
json format (structure) to API
Question
Application Type
Reactive
Service Studio Version
11.55.8 (Build 63965)
Platform Version
11.33.0 (Build 44426)

Good day i have this api where it can do bulk orders, and inside the documents it said that "There is a 2000 limit but we might decide to change it to a lower / higher value at any given time depending if we find this value is too high or too low with time. " so the limitations include a maximum of 2000 orders per import and only one import can run at a time per project, how can i do the 2000 bulk orders with just one call api? is it possible is there i way i can do this on a loop? i am using a structure and its json


Thanks so much mam and sirs!

CVS_TO_Json (1).oml
2022-12-30 07-28-09
Navneet Garg
Solution

please check this solution. it is working with the csv given by you.


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

you can create a list of structure and after that you can serialize in json. can you share more detail like payload json you are trying to sending to api.


I checked your oml file but there is no api implementation that I can follow so please provide more detail so it will be easy to help

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

I use the sample json given in api documentation and created a structure using this json

created a server action with a local vairable ListOfOrders

and appeding values in the ListOfOrders and after that I can use JSONSerialize and send this to the api. It should work.


UserImage.jpg
jesu verso

may ia ask sir why u dont use for loop for one by one?

UserImage.jpg
jesu verso

i got this error sir

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

you can not directly pass the json to the request. It is a structure you need to convert your json to the structure and that pass that structure to the request.

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

You can use loop to append data in to the list and pass that list to the api

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

I provided the oml file you can check the implementation there.

UserImage.jpg
jesu verso

i follow what you did and it worked! the problem sir is the one that is passing only in the api is just the start? how can i do it until the first and last!??

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

you need to append element in the list using loop can you share your oml file so I can see and implement solution accordingly ?

you need to loop your data source and append element in the list using listappend server action.

then pass that list variable to the api.

Is your data source is csv ? or you fetching data from database ?

UserImage.jpg
jesu verso

after i use csv to json i send into API

UserImage.jpg
jesu verso
testingforloop.oml
2022-12-30 07-28-09
Navneet Garg

No need to loop now as you are using list you can directly pass it to the your api.


can you share your csv file as well ?

UserImage.jpg
jesu verso

cant share the csv file sir. i apologize. can i know i don need for loop?

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

Do not share actual csv share a dummy csv so I can confirm and send you solution oml

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

Do not need loop as it is already a list


UserImage.jpg
jesu verso

IVE tried this sir but this doesnt work sir. :(( still stuck in here

2022-12-30 07-28-09
Navneet Garg
UserImage.jpg
jesu verso
testingforloop.oml
aaaaaass.csv
2022-12-30 07-28-09
Navneet Garg
Solution

please check this solution. it is working with the csv given by you.


testingforloop_f1.oml
UserImage.jpg
jesu verso

thank you so much for this sir might try this later. 

2025-12-03 17-22-41
Lavanya Kamalaguru

Hi @jesu verso,

Could you please share your API structure.

I have updated your oml. Please check.

CVS_TO_Json (1) (1).oml
UserImage.jpg
jesu verso

my api structure is the link you can check it sir its import order

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

I implemented api using sample data please check the oml. Hope this will help you.

voucherifyio1.oml
UserImage.jpg
jesu verso

thanksmight try this sir. sorry for late reply


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

no worries. hope my solution works for you.

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