You need to sign in to do that
Don't have an account?
Kam.ax1015
Passing nested structure to Apex Rest controller
Hello,
Following the thread
@HttpPost global static string create(Account account, List<Contact> contacts) { insert account; for (Contact c : contacts) c.accountId = account.Id; insert contacts; return account.id; }
Let's say if each contact itself has nested objects, or other example is Account can have multiple orders and each order can have order details and each order detail can have multiple parts. Is it possible to pass that? Would Apex controller unmarshall the nested structures? I wish there were REST serializers/deserializers as part of Salesforce APEX framework to do that. Please advise.
Thanks,
Kam
You can define custom classes that have the structure you want, similar to how it works for the apex soap services.
But we still need to deserialize the REST string in to that complex structure? In java I use flejson library to do that. Right?
Thanks,
Kam
Ahh, I misspoke, that's not in the current pilot version, but its on the plan.
So I guess answer is right now there is no easy way to do that.
Thanks a lot for your prompt help.
Kam