0
0
Rest APIprogramming~10 mins

Request body structure in Rest API - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a JSON request body with a user's name.

Rest API
{
  "name": "[1]"
}
Drag options to blanks, or click blank then click option'
A123
BJohn
Ctrue
Dnull
Attempts:
3 left
💡 Hint
Common Mistakes
Using numbers or boolean values instead of a string for the name.
2fill in blank
medium

Complete the code to add an age field as a number in the JSON request body.

Rest API
{
  "age": [1]
}
Drag options to blanks, or click blank then click option'
A25
Btwenty-five
C"25"
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numbers inside quotes making them strings.
Using words or boolean values instead of numbers.
3fill in blank
hard

Fix the error in the JSON request body by completing the missing value for the 'active' field.

Rest API
{
  "active": [1]
}
Drag options to blanks, or click blank then click option'
A"yes"
Bnull
Ctrue
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using strings like "yes" instead of boolean true.
Using numbers like 1 instead of true.
4fill in blank
hard

Fill both blanks to create a JSON request body with a list of tags and a count of tags.

Rest API
{
  "tags": [1],
  "count": [2]
}
Drag options to blanks, or click blank then click option'
A["red", "blue", "green"]
B"red, blue, green"
C3
D"3"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of an array for tags.
Putting the count number inside quotes.
5fill in blank
hard

Fill all three blanks to create a JSON request body with a nested object for address.

Rest API
{
  "user": "[1]",
  "address": {
    "city": "[2]",
    "zip": [3]
  }
}
Drag options to blanks, or click blank then click option'
AAlice
BWonderland
C12345
D12345-6789
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numbers inside quotes or text without quotes.
Using zip code as a string with a dash when only numbers are expected.