Pie Logo
Quiz: APIs
by Tomas Trescak

QuizTest your understanding of the section content.

ContentDetailed description of the section content.

Full Stack Development
Introduction
Generative AI
🍰 Player
💼 Editor
Setup
React Fundamentals
Next.js
Advanced React
Databases
React Hooks
Authentication and Authorisation
APIs
APIs
Quiz: APIs
Rest APIs
tRPC
Securing APIs
CI/CD and DevOps
Testing React
Advanced Topics
    Pie Logo
    Quiz: APIs
    by Tomas Trescak

    QuizTest your understanding of the section content.

    ContentDetailed description of the section content.

    Full Stack Development
    Introduction
    Generative AI
    🍰 Player
    💼 Editor
    Setup
    React Fundamentals
    Next.js
    Advanced React
    Databases
    React Hooks
    Authentication and Authorisation
    APIs
    APIs
    Quiz: APIs
    Rest APIs
    tRPC
    Securing APIs
    CI/CD and DevOps
    Testing React
    Advanced Topics
    QUESTION 1

    In the blogging app, a user taps a button to see all posts tagged “travel.” The app sends this request:

    GET https://myblog.com/api/posts?tag=travel

    The server responds with:

    {
      "posts": [
        {
          "id": 1,
          "title": "My Trip to Paris",
          "tag": "travel"
        }
      ]
    }

    What role does the API play here?


    QUESTION 2

    You’re an admin adding a new post to the blogging app with this request:

    POST https://myblog.com/api/posts
     

    Body:

    {
      "title": "Beach Day!",
      "tag": "travel",
      "content": "Loved the sun!"
    }

    The server responds with:

    {
      "id": 3,
      "status": "Post created"
    }

    What does the POST method tell the server to do?


    QUESTION 3

    You test the “Dad Joke” API in your terminal:

    curl -H "Accept: application/json" https://icanhazdadjoke.com/

    The response is:

    {
      "id": "abc123",
      "joke": "Why don’t skeletons fight? They don’t have the guts.",
      "status": 200
    }

    Why might you choose JSON over plain text for the blogging app?


    QUESTION 4

    The blogging app filters posts by date with this request:

    GET https://myblog.com/api/posts?date=2025-03

    The server returns:

    {
      "posts": [
        {
         "id": 1, 
         "title": "My Trip to Paris", 
         "date": "2025-03-01"\
        }, 
        {
          "id": 2, 
          "title": "Hiking in Japan", 
          "date": "2025-03-15"
        }
      ]
    }

    What would happen if the app used GraphQL instead of REST for this?


    QUESTION 5

    Imagine a news feed app subscribes to the blogging app’s API. When you add a new post, the news feed gets updated instantly. Which API type makes this possible?

    This content is only available to registered users.
    Please register at the the home page.

    QUESTION 1

    In the blogging app, a user taps a button to see all posts tagged “travel.” The app sends this request:

    GET https://myblog.com/api/posts?tag=travel

    The server responds with:

    {
      "posts": [
        {
          "id": 1,
          "title": "My Trip to Paris",
          "tag": "travel"
        }
      ]
    }

    What role does the API play here?


    QUESTION 2

    You’re an admin adding a new post to the blogging app with this request:

    POST https://myblog.com/api/posts
     

    Body:

    {
      "title": "Beach Day!",
      "tag": "travel",
      "content": "Loved the sun!"
    }

    The server responds with:

    {
      "id": 3,
      "status": "Post created"
    }

    What does the POST method tell the server to do?


    QUESTION 3

    You test the “Dad Joke” API in your terminal:

    curl -H "Accept: application/json" https://icanhazdadjoke.com/

    The response is:

    {
      "id": "abc123",
      "joke": "Why don’t skeletons fight? They don’t have the guts.",
      "status": 200
    }

    Why might you choose JSON over plain text for the blogging app?


    QUESTION 4

    The blogging app filters posts by date with this request:

    GET https://myblog.com/api/posts?date=2025-03

    The server returns:

    {
      "posts": [
        {
         "id": 1, 
         "title": "My Trip to Paris", 
         "date": "2025-03-01"\
        }, 
        {
          "id": 2, 
          "title": "Hiking in Japan", 
          "date": "2025-03-15"
        }
      ]
    }

    What would happen if the app used GraphQL instead of REST for this?


    QUESTION 5

    Imagine a news feed app subscribes to the blogging app’s API. When you add a new post, the news feed gets updated instantly. Which API type makes this possible?

    This content is only available to registered users.
    Please register at the the home page.

    Pie Logo
    Quiz: APIs
    by Tomas Trescak
    Pie Logo
    Quiz: APIs
    by Tomas Trescak
    Full Stack Development
    Introduction
    Generative AI
    🍰 Player
    💼 Editor
    Setup
    React Fundamentals
    Next.js
    Advanced React
    Databases
    React Hooks
    Authentication and Authorisation
    APIs
    APIs
    Quiz: APIs
    Rest APIs
    tRPC
    Securing APIs
    CI/CD and DevOps
    Testing React
    Advanced Topics
    Full Stack Development
    Introduction
    Generative AI
    🍰 Player
    💼 Editor
    Setup
    React Fundamentals
    Next.js
    Advanced React
    Databases
    React Hooks
    Authentication and Authorisation
    APIs
    APIs
    Quiz: APIs
    Rest APIs
    tRPC
    Securing APIs
    CI/CD and DevOps
    Testing React
    Advanced Topics