Merge two different API calls into One
- by dhilipsiva
I have two different apps in my django project. One is "comment" and an other one is "files". A comment might save some file attached to it.
The current way of creating a comment with attachments is by making two API calls. First one creates an actual comment and replies with the comment ID which serves as foreign key for the Files. Then for each file, a new request is made with the comment ID.
Please note that file is a generic app, that can be used with other apps too. What is the cleanest way of making this into one API call?
I want to have this as a single API call because I am in a situation where I need to send user an email with all the files as attachment when a comment is made. I know Queueing is the ideal way to do it. But I don't have the liberty to add queing to our stack now. So this was the only way I could think of.