API Testing · Junior · Question 29 of 75

What does this curl command do?

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Ann"}'
Show the answer

Correct answer: Sends a POST with a JSON body to create a user

Explanation

-X sets the method, -H adds a header and -d sends the body. Adding a curl command to a bug report lets anyone reproduce it.

Further reading

Problem with a question

API Testing · Junior · question 29

Test yourself

Take the API Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz