Looking at two of our entities Company and Address. A company has a billingAddress and a profileAddress.
I'm unsure of how to implement a function to set the billing address versus the profile. Here are the options I can see:
Create a new address using a
POSTto/address. Update the company object at/companywithprofileAddress = {/* the new id of the address */}Execute
/company/:id?function=updateBillingAddress&{/* rest of parameters go here */}Execute
/updateBillingAddress?company={companyId}&{/* rest of parameters go here */}Execute
/company/:id?billingAddress={ /* address data here */ }
The first method requires two calls and more responsibility on the part of the developer hooking up to the API. However, I'm not sure the second two methods are appropriate structure.
The last one seems like it might be okay, it gives flexibility for updates without holding the responsibility of managing pointers or executing two calls.. still unsure.
Has anyone seen use of methods 2 or 3 before. Are they okay to use? Why / why not? Which would you suggest to use and why?