0
0
Rest APIprogramming~20 mins

Bulk import and export in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Bulk Import and Export Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this bulk import API response?

Consider a REST API endpoint that accepts a JSON array of user objects for bulk import. The server responds with a summary JSON object showing how many users were successfully imported and how many failed.

Given the following server response after sending 5 user objects, what is the output?

Rest API
{
  "imported": 4,
  "failed": 1,
  "errors": [
    {"index": 3, "message": "Email already exists"}
  ]
}
A{"imported":4,"failed":1,"errors":[{"index":3,"message":"Email already exists"}]}
B{"imported":5,"failed":0,"errors":[]}
C{"imported":3,"failed":2,"errors":[{"index":1,"message":"Invalid data"},{"index":4,"message":"Missing field"}]}
D{"imported":0,"failed":5,"errors":[{"index":0,"message":"Server error"}]}
Attempts:
2 left
💡 Hint

Look carefully at the numbers and error details in the JSON response.

🧠 Conceptual
intermediate
1:30remaining
Which HTTP method is best suited for bulk export of data?

You want to design a REST API endpoint that allows clients to export large amounts of data in bulk. Which HTTP method should you use?

AGET
BPUT
CPOST
DDELETE
Attempts:
2 left
💡 Hint

Think about which method is used to retrieve data without changing server state.

🔧 Debug
advanced
2:30remaining
Why does this bulk import request fail with a 400 error?

Here is a JSON payload sent to a bulk import API:

[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}, {"id":3,"name":null}]

The server responds with HTTP 400 Bad Request. What is the most likely cause?

AThe 'id' fields are not unique.
BThe third object has a null value for the 'name' field which is required.
CThe JSON array is missing a closing bracket.
DThe server does not accept arrays, only single objects.
Attempts:
2 left
💡 Hint

Check the data values carefully for required fields.

📝 Syntax
advanced
2:00remaining
Which JSON payload is correctly formatted for bulk export request filters?

You want to request a bulk export with filters on user status and creation date. Which JSON payload is syntactically correct?

A{"filters": {"status" => "active", "created_after" => "2023-01-01"}}
B{"filters": ["status": "active", "created_after": "2023-01-01"]}
C{"filters": {status: "active", created_after: "2023-01-01"}}
D{"filters": {"status": "active", "created_after": "2023-01-01"}}
Attempts:
2 left
💡 Hint

Remember JSON requires double quotes around keys and string values, and uses colons, not arrows.

🚀 Application
expert
3:00remaining
How many user records will be created after this bulk import API call?

An API accepts a bulk import POST request with this JSON payload:

[{"id":1,"email":"a@example.com"},{"id":2,"email":"b@example.com"},{"id":3,"email":"a@example.com"},{"id":4,"email":"d@example.com"}]

The API rejects duplicates by email and skips them silently. How many user records will be created?

A1
B4
C3
D2
Attempts:
2 left
💡 Hint

Count unique emails only, duplicates are skipped.