×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Matt Parry
Added: Jul 7, 2017 3:05 PM
Views: 2416
Tags: no tags
  1. Title
  2.  
  3. <Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>
  4.  
  5. URL
  6.  
  7. <The URL Structure (path only, no root url)>
  8.  
  9. Method:
  10.  
  11. <The request type>
  12.  
  13. GET | POST | DELETE | PUT
  14.  
  15. URL Params
  16.  
  17. <If URL params exist, specify them in accordance with name mentioned in URL section. Separate into optional and required. Document data constraints.>
  18.  
  19. Required:
  20.  
  21. id=[integer]
  22.  
  23. Optional:
  24.  
  25. photo_id=[alphanumeric]
  26.  
  27. Data Params
  28.  
  29. <If making a post request, what should the body payload look like? URL Params rules apply here too.>
  30.  
  31. Success Response:
  32.  
  33. <What should the status code be on success and is there any returned data? This is useful when people need to to know what their callbacks should expect!>
  34.  
  35. Code: 200
  36. Content: { id : 12 }
  37. Error Response:
  38.  
  39. <Most endpoints will have many ways they can fail. From unauthorized access, to wrongful parameters etc. All of those should be liste d here. It might seem repetitive, but it helps prevent assumptions from being made where they should be.>
  40.  
  41. Code: 401 UNAUTHORIZED
  42. Content: { error : "Log in" }
  43. OR
  44.  
  45. Code: 422 UNPROCESSABLE ENTRY
  46. Content: { error : "Email Invalid" }
  47. Sample Call:
  48.  
  49. <Just a sample call to your endpoint in a runnable format ($.ajax call or a curl request) - this makes life easier and more predictable.>
  50.  
  51. Notes:
  52.  
  53. <This is where all uncertainties, commentary, discussion etc. can go. I recommend timestamping and identifying oneself when leaving comments here.>