rest - RESTful HTTP API design pattern for specifying file pairs? -


i attempting design http api whereby callers upload n pairs of files per call. utilize toy example guide discussion.

imagine i'm collecting database of photos have been doctored. each record uploaded, need 2 files: (1) original photo, , (2) doctored photo. users upload records in batches. example, let's assume user upload 2 records.

i have considered 2 options:

  1. nested forms: curl -f "record=@orig0.jpg,doc0.jpg" -f "record=@orig1.jpg,doc1.jpg"

    this results in top-level form parts containing records, each record contains sub-form parts photo files.

    pros: logically accurate. can done curl.

    cons: sub-form parts don't have field names. difficult through other clients.

  2. form parts dynamic field names:

    curl -f "record0_original=@orig0.jpg" -f "record0_doctored=@doc0.jpg" -f "record01_original=@orig1.jpg" -f "record1_doctored=@doc1.jpg"

    pros: field labels present , expressive.

    cons: uses dynamic field names impart structure.

is there option? there established design pattern specifying multiple binary files , relationships between them?


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -