0
0
Rest APIprogramming~10 mins

Resource expansion (embed related data) 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 request expanded user data with embedded posts.

Rest API
GET /users/123?[1]=expand
Drag options to blanks, or click blank then click option'
Aexpand
Bembed
Cinclude
Dattach
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'embed' or 'include' which might not be supported by the API.
Forgetting to add the query parameter.
2fill in blank
medium

Complete the code to embed comments when fetching posts.

Rest API
GET /posts?[1]=embed
Drag options to blanks, or click blank then click option'
Aexpand
Binclude
Cfields
Dembed
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'expand' which might not work for this API.
Using 'fields' which is for selecting fields, not embedding.
3fill in blank
hard

Fix the error in the URL to correctly expand the 'author' data for each comment.

Rest API
GET /comments?expand=[1]
Drag options to blanks, or click blank then click option'
Ausers
Bauthor
Cuser
Dauthors
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural form 'authors' which causes an error.
Using 'user' or 'users' which are incorrect resource names.
4fill in blank
hard

Fill both blanks to embed 'profile' and 'settings' data when fetching users.

Rest API
GET /users?[1]=embed&[2]=include
Drag options to blanks, or click blank then click option'
Aembed
Bexpand
Cinclude
Dfields
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same parameter twice.
Using 'fields' which is for selecting fields, not embedding.
5fill in blank
hard

Fill all three blanks to select 'orders', embed 'items', and include 'shipping' data in a single request.

Rest API
GET /customers/456?[1]=fields&[2]=embed&[3]=include
Drag options to blanks, or click blank then click option'
Aexpand
Bembed
Cinclude
Dfields
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'expand' for all parameters which may cause errors.
Mixing up 'embed' and 'include' parameters.