You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.0 KiB

  1. FORMAT: 1A
  2. HOST: https://polls.apiblueprint.org/
  3. # IngridMi
  4. Polls is a simple API allowing consumers to view polls and vote in them.
  5. ## Questions Collection [/questions]
  6. ### List All Questions [GET]
  7. + Response 200 (application/json)
  8. [
  9. {
  10. "question": "Favourite programming language?",
  11. "published_at": "2015-08-05T08:40:51.620Z",
  12. "choices": [
  13. {
  14. "choice": "Swift",
  15. "votes": 2048
  16. }, {
  17. "choice": "Python",
  18. "votes": 1024
  19. }, {
  20. "choice": "Objective-C",
  21. "votes": 512
  22. }, {
  23. "choice": "Ruby",
  24. "votes": 256
  25. }
  26. ]
  27. }
  28. ]
  29. ### Create a New Question [POST]
  30. You may create your own question using this action. It takes a JSON
  31. object containing a question and a collection of answers in the
  32. form of choices.
  33. + Request (application/json)
  34. {
  35. "question": "Favourite programming language?",
  36. "choices": [
  37. "Swift",
  38. "Python",
  39. "Objective-C",
  40. "Ruby"
  41. ]
  42. }
  43. + Response 201 (application/json)
  44. + Headers
  45. Location: /questions/2
  46. + Body
  47. {
  48. "question": "Favourite programming language?",
  49. "published_at": "2015-08-05T08:40:51.620Z",
  50. "choices": [
  51. {
  52. "choice": "Swift",
  53. "votes": 0
  54. }, {
  55. "choice": "Python",
  56. "votes": 0
  57. }, {
  58. "choice": "Objective-C",
  59. "votes": 0
  60. }, {
  61. "choice": "Ruby",
  62. "votes": 0
  63. }
  64. ]
  65. }