0
0
Rest APIprogramming~10 mins

Problem Details (RFC 7807) format 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 set the 'type' field in the Problem Details JSON.

Rest API
{
  "type": "[1]",
  "title": "Invalid Request",
  "status": 400
}
Drag options to blanks, or click blank then click option'
Aerror
Babout:blank
Chttp://example.com/error
Dhttps://example.com/probs/out-of-credit
Attempts:
3 left
💡 Hint
Common Mistakes
Using a plain string instead of a URI for 'type'.
Leaving the 'type' field empty.
2fill in blank
medium

Complete the code to add the 'detail' field explaining the error.

Rest API
{
  "type": "about:blank",
  "title": "Invalid Request",
  "status": 400,
  "detail": "[1]"
}
Drag options to blanks, or click blank then click option'
AThe request parameters are invalid.
BInvalid
C400
DError
Attempts:
3 left
💡 Hint
Common Mistakes
Putting a status code number instead of a message.
Using a single word instead of a full explanation.
3fill in blank
hard

Fix the error in the 'status' field to use the correct HTTP status code.

Rest API
{
  "type": "about:blank",
  "title": "Not Found",
  "status": [1]
}
Drag options to blanks, or click blank then click option'
A"404"
B400
C404
DNotFound
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of a number for status.
Using the wrong status code.
4fill in blank
hard

Fill both blanks to add an 'instance' URI and a custom 'error_code' field.

Rest API
{
  "type": "about:blank",
  "title": "Unauthorized",
  "status": 401,
  "instance": "[1]",
  "error_code": "[2]"
}
Drag options to blanks, or click blank then click option'
A/login
B/home
CAUTH_001
DERR_404
Attempts:
3 left
💡 Hint
Common Mistakes
Using a full URL instead of a relative URI for 'instance'.
Using a wrong or unrelated error code.
5fill in blank
hard

Fill all three blanks to create a Problem Details JSON with a custom type, title, and status.

Rest API
{
  "type": "[1]",
  "title": "[2]",
  "status": [3]
}
Drag options to blanks, or click blank then click option'
Ahttps://example.com/probs/out-of-credit
BOut of Credit
C403
DForbidden
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the status code as a string.
Using a non-URI string for 'type'.