test.http 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. @remote_url = http://localhost:9000
  2. @api_url = http://192.168.0.11:4000/store
  3. @exec_url = http://192.168.0.11:4000/execute
  4. @auth_url = http://192.168.0.11:4000/auth
  5. ### LIST
  6. GET {{api_url}}/boxId/ HTTP/1.1
  7. x-spc-host: {{remote_url}}
  8. ### CREATE FOO
  9. # @name createElem
  10. POST {{api_url}}/boxId/ HTTP/1.1
  11. content-type: application/json
  12. {
  13. "name": "foo"
  14. }
  15. ### CREATE BAR
  16. POST {{api_url}}/boxId/ HTTP/1.1
  17. content-type: application/json
  18. {
  19. "name": "bar"
  20. }
  21. ### LIST with limit, skip and sort
  22. GET {{api_url}}/boxId/?limit=2&sort=-name&skip=1&fields=name,_id HTTP/1.1
  23. ### GET
  24. @elemId = {{createElem.response.body.$._id}}
  25. GET {{api_url}}/boxId/{{elemId}} HTTP/1.1
  26. ### UPDATE
  27. @elemId = {{createElem.response.body.$._id}}
  28. PUT {{api_url}}/boxId/{{elemId}} HTTP/1.1
  29. content-type: application/json
  30. {
  31. "other": "baz"
  32. }
  33. ### DELETE
  34. @elemId = {{createElem.response.body.$._id}}
  35. DELETE {{api_url}}/boxId/{{elemId}} HTTP/1.1
  36. # With authentication ########################
  37. ### CREATE TIP
  38. # @name createElemKey
  39. POST {{api_url}}/boxId/?key=testkey HTTP/1.1
  40. content-type: application/json
  41. {
  42. "name": "tip"
  43. }
  44. ### UPDATE with good key
  45. @elemIdWithKey = {{createElemKey.response.body.$._id}}
  46. PUT {{api_url}}/boxId/{{elemIdWithKey}}?key=testkey HTTP/1.1
  47. content-type: application/json
  48. {
  49. "other": "baz"
  50. }
  51. ### UPDATE with bad key
  52. @elemIdWithKey = {{createElemKey.response.body.$._id}}
  53. PUT {{api_url}}/boxId/{{elemIdWithKey}}?key=badkey HTTP/1.1
  54. content-type: application/json
  55. {
  56. "other": "baz"
  57. }
  58. ### DELETE with bad key
  59. @elemIdWithKey = {{createElemKey.response.body.$._id}}
  60. DELETE {{api_url}}/boxId/{{elemIdWithKey}}?key=badkey HTTP/1.1
  61. ### DELETE with good key
  62. @elemIdWithKey = {{createElemKey.response.body.$._id}}
  63. DELETE {{api_url}}/boxId/{{elemIdWithKey}}?key=testkey HTTP/1.1
  64. # Execution module
  65. ### just get test
  66. GET {{exec_url}}/test/?param1=toto HTTP/1.1
  67. x-spc-host: http://localhost:9000
  68. # Auth module
  69. ### Get token
  70. POST {{auth_url}}/ HTTP/1.1
  71. {
  72. "userId": "test@yopmail.com"
  73. }
  74. ### LIST GAME
  75. GET {{api_url}}/game/ HTTP/1.1
  76. x-spc-host: {{remote_url}}
  77. ### just get test
  78. GET {{exec_url}}/test/?param1=toto HTTP/1.1
  79. x-spc-host: http://localhost:9000/