Advertisement
Guest User

Untitled

a guest
Nov 6th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.71 KB | None | 0 0
  1. A few general notes:
  2. * We switched from Mongo to Postgres, so all the lookups are ID based rather than filename/foldername based.
  3. * There's a new table "photo_sequence". The hierarchy is "folder 1->* photo_sequence 1->* upload", where a "sequence" denotes e.g. one run through the gif sequence, the uploads are each of the individual phots, gifs, user-edits, etc from that sequence.
  4. * Folders can contain multiple "galleries", each of which has its own sharing configuration. A common use case is in printer mode, they'll have one gallery for the individual shots allowing social, and one for the composites just allowing prints, and run two separate tablets.
  5. * The workflow for customizing images and forms has been improved, allowing things like gif annotation without custom code.
  6. * I denote an array of objects below by brackets, e.g. [string] is a string array or [{id:int;name:string}] is an array of that record type.
  7. * ... means there are other fields you can ignore
  8. * v4 api servers: api.smilebooth.com, api-test.smilebooth.com
  9. * v4 web servers: admin.smilebooth.com, admin-test.smilebooth.com (these are just for you manually to configure folders; your app should always hit the API server)
  10. * (v4 test and prod are currently the same)
  11. * smileport: port 20003
  12.  
  13. /api/v4/user/get-by-login-info
  14. Input:
  15. { username: string
  16. password: string }
  17. Output:
  18. { token: string
  19. ... }
  20. Description: You'll need this for direct-to-cloud connections. The only field you need is "token", which you'll need to add to the "x-user-token" header in all subsequent API posts.
  21.  
  22.  
  23.  
  24. /api/v4/folders/list-names
  25. Description: Returns all folders user has access to, or in offline mode returns all folders on smileport. (There's no longer a need for a portal selection step; this endpoint returns all folders in all portals that user has access to)
  26. Input: none
  27. Output:
  28. [ { id: int
  29. name: string } ]
  30.  
  31.  
  32. /api/v4/folders/get-sharing-details
  33. Description: Returns all galleries in that folder. Each gallery has its own name, id, and sharing configuration. Prompt the user to choose a gallery, and use the corresponding info onward in the app.
  34. Input:
  35. { id: int } (the id of the folder selected above)
  36. Output:
  37. { folder: { ... }
  38. galleries:
  39. [ { id: int
  40. name: string
  41. tablet:
  42. { customThemeEnable: bool
  43. customThemeUrl: string
  44. printEnable: bool
  45. aviaryEnable: bool
  46. useFormstack: bool
  47. formstackUrl: string
  48. customOverlaysEnable: bool
  49. customOverlayUrls: [ string ]
  50. customBackgroundUrls: [ string ]
  51. ... }
  52. form:
  53. { enable: bool
  54. termsOfService: string
  55. requireOptIn: bool
  56. requireOptInDefaultChecked: bool
  57. optInText: string
  58. askName: bool
  59. askZip: bool
  60. askBirthday: bool
  61. customFields: [ string ]
  62. useProcessingScript: bool }
  63. email:
  64. { enable: bool
  65. ... }
  66. mms:
  67. { enable: bool
  68. ... }
  69. twitter:
  70. { enable: bool
  71. tweet: string
  72. ... }
  73. ... } ] }
  74. Notes:
  75. * Oauth is dead on tablets, so no more facebook and twitter is handled differently (see below)
  76. * form.customFields is a list of custom field names|labels to append to the form. i.e. if there's an entry "mood|How Are You?" you'd append a textbox with label "How Are You?", and submit the answer as "mood" in the JSON.
  77. * form.useProcessingScript described below in upload-apply-script
  78. * We allow any combo of customization/workflow options to be enabled in a gallery. Then on the tablet they're done one at a time in the order [background->aviary->overlay->form->formstack] before showing the sharing buttons.
  79.  
  80.  
  81. /api/v4/images/list-by-gallery
  82. Description: Gets all the photos by gallery.
  83. Input:
  84. { galleryId: int
  85. since: int64 }
  86. Output:
  87. [ { id: int64
  88. sequenceId: int64
  89. url: string
  90. thumbUrl: string
  91. ... } ]
  92. Notes:
  93. * sequenceId is a key to denote "related" photos. So e.g. when you do the Aviary workflow, you'd upload the user-edited version with the same sequenceId as the original.
  94.  
  95.  
  96. /api/v4/images/get
  97. Description: Gets a photo metadata by id
  98. Input: int64 (the id)
  99. Output:
  100. { id: int64
  101. sequenceId: int64
  102. url: string
  103. thumbUrl: string
  104. ... }
  105. Notes:
  106. * this is used for displaying the results of "upload-apply-script" and other server-side photo processing results detailed below.
  107.  
  108.  
  109. /api/v4/sequences/create
  110. Description: Creates a new sequenceId.
  111. Input:
  112. { folderId: int
  113. mode: int
  114. source: string }
  115. Output: int (the id)
  116. Notes:
  117. * On tablets, this is only needed for the "Local Directory Watcher" feature -- for each new photo you'd first create a new sequenceId and then upload using that id (see upload-* endpoint)
  118. * "mode" should always be zero, meaning "clicker mode", in tablet directory watcher workflows; source can be "iPad".
  119. * All other tablet functionality you're modifying an existing image, so you'd reuse the same sequenceId.
  120.  
  121.  
  122. /api/v4/images/upload
  123. Description: Uploads a photo.
  124. Input: MULTIPART
  125. "info" :
  126. { sequenceId: int64
  127. subtype: int
  128. position: int }
  129. "media": the bytes.
  130. Output: int64 (the id)
  131. Notes:
  132. * Only used in directory watcher scenario.
  133. * Ensure filename is included in the "media" section.
  134.  
  135.  
  136. /api/v4/images/upload-user-edit
  137. Description: Uploads a user-edited photo (aviary)
  138. Input: MULTIPART
  139. "info" : { sequenceId: int64 }
  140. "media" the bytes.
  141. Output: int64 (the id)
  142. Notes:
  143. * sequenceId should match that of the original photo
  144. * Only used in aviary scenario.
  145. * Ensure filename is included in the "media" section.
  146.  
  147.  
  148. /api/v4/images/upload-apply-overlay
  149. Description: Uploads a custom overlay/background photo
  150. Input: MULTIPART
  151. "info" : { sequenceId: int64 }
  152. "background" the bytes of the background image.
  153. "overlay" the bytes of the overlay image (presumably a png file).
  154. Output: int64 (the id)
  155. Notes:
  156. * sequenceId should match that of the original photo
  157. * So for custom overlays you'd set the original image to "background" and the chosen overlay to "overlay"; for custom backgrounds you'd set the background to "background" and the keyed original png to "overlay".
  158. * This means you don't have to process the photo on the tablet (in Android it made things easier because I could just have a static background and a slider on top for the user to select overlay).
  159. * Then to get the URL of the resulting photo, you call "images/get" with the returned id from here.
  160.  
  161.  
  162. /api/v4/images/upload-apply-script
  163. Description: Applies an imagemagick script to an image
  164. Input: MULTIPART
  165. "info" :
  166. { sequenceId: int64
  167. galleryId: int }
  168. "args" :
  169. { firstName: string
  170. lastName: string
  171. ...: string }
  172. "media" the bytes.
  173. Output: int64 (the id)
  174. Notes:
  175. * You use this after the user fills out a form and form.useProcessingScript is set.
  176. * It sends the photo along with all the form data (in "args") to an imagemagick script that will be running, so it can e.g. watermark your photo with your name for instance.
  177. * (Combined with the custom form fields feature, it allows you to set up all kinds of stuff like gif annotation without needing special software)
  178. * sequenceId should match that of the original photo
  179. * galleryId should be your current gallery
  180.  
  181.  
  182.  
  183. *** The below are all sharing, with similar structures ***
  184. /api/v4/sharers/email/share
  185. Input:
  186. { uploadId: int64
  187. galleryId: int
  188. email: string
  189. formData: string }
  190. /api/v4/sharers/mms/share
  191. Input:
  192. { uploadId: int64
  193. galleryId: int
  194. phone: string
  195. formData: string }
  196. /api/v4/sharers/twitter/share
  197. Input:
  198. { uploadId: int64
  199. galleryId: int
  200. username: string
  201. formData: string }
  202. Notes:
  203. * Twitter now just tweets from the @smilebooth account, appending @username to the tweet so the user receives it without needing to go through oauth.
  204. * Usually we'll have it use twitter cards to point to our web galleries, which has all the standard social sharing links, to make resharing on other platforms easier and safer. Nobody trusted oauth.
  205. /api/v4/sharers/print/share
  206. Input:
  207. { uploadId: int64 }
  208. Outputs: int64 (the new record ID - you can ignore it)
  209. Notes:
  210. * formData is a JSON-encoded string rather than being an actual sub-object here.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement