fetching.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <div>
  3. <h1 class="primary--text">Basic Fetching Tutorial</h1>
  4. <span>Example to get votes of a given YouTube video ID:</span>
  5. <a href="https://youtube.com/watch?v=kxOuG8jMIgI" target="_blank">kxOuG8jMIgI</a><br /><br />
  6. <h2>Example Request:</h2>
  7. <span><b>Request URL:</b></span>
  8. <a :href="apiUrl + '/votes?videoId=kxOuG8jMIgI'" target="_blank"
  9. v-text="apiUrl + '/votes?videoId=kxOuG8jMIgI'" /><br />
  10. <span><b>Request Method:</b>
  11. <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET" target="_blank">HTTP/GET</a></span><br />
  12. <span><b>Headers:</b></span><br />
  13. <code class="code">
  14. Accept: text/html,application/xhtml+xml,application/xml;q=0.9<br />
  15. Pragma: no-cache<br />
  16. Cache-Control: no-cache<br />
  17. Connection: keep-alive </code><br />
  18. <span><b>Response:</b></span><br />
  19. <div class="code">
  20. <code style="background-color: rgba(0, 0, 0, 0)">
  21. {<br />
  22. "id": "kxOuG8jMIgI",<br />
  23. "dateCreated": "2021-12-20T12:25:54.418014Z",<br />
  24. "likes": 27326,<br />
  25. "dislikes": 498153,<br />
  26. "rating": 1.212014408444885,<br />
  27. "viewCount": 3149885,<br />
  28. "deleted": false<br />
  29. }
  30. </code>
  31. </div>
  32. <br /><br />
  33. <v-alert border="left" color="orange" text type="info">
  34. <span>An invalid YouTube ID will return status code 404 "Not Found".</span><br />
  35. <span>An incorrectly formatted YouTube ID will return 400 "Bad
  36. Request".</span>
  37. </v-alert>
  38. <a :href="endpointUrl" target="_blank" v-text="endpointUrl" />
  39. </div>
  40. </template>
  41. <style scoped>
  42. .code {
  43. width: 100%;
  44. background: #353535;
  45. border-radius: 3px;
  46. }
  47. </style>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. apiUrl: process.env.apiUrl,
  53. };
  54. },
  55. };
  56. </script>