nerdexam
Huawei

H12-891_V1.0 · Question #176

The engineer calls the RESTful interface to create a resource. When the resource is created successfully, the server will not return which of the following status codes?

The correct answer is A. 301. 301 (Moved Permanently) is a redirect status code - it tells the client the resource has moved to a new URL permanently, which has nothing to do with resource creation. When a REST API successfully creates a resource, it returns one of the 2xx success codes: 201 Created (the…

SDN and Network Automation

Question

The engineer calls the RESTful interface to create a resource. When the resource is created successfully, the server will not return which of the following status codes?

Options

  • A301
  • B200
  • C202
  • D201

How the community answered

(20 responses)
  • A
    75% (15)
  • B
    5% (1)
  • C
    15% (3)
  • D
    5% (1)

Explanation

301 (Moved Permanently) is a redirect status code - it tells the client the resource has moved to a new URL permanently, which has nothing to do with resource creation. When a REST API successfully creates a resource, it returns one of the 2xx success codes: 201 Created (the most semantically correct, indicating the resource was created and often includes a Location header pointing to it), 200 OK (acceptable when the server returns the created resource in the response body), or 202 Accepted (used when creation is asynchronous - the request was accepted but processing isn't complete yet). A helpful memory tip: 3xx codes are always about redirection, never about success or failure of an operation - if you see a 3xx in a creation context, it's wrong by definition.

Topics

#RESTful API#HTTP status codes#resource creation#REST

Community Discussion

No community discussion yet for this question.

Full H12-891_V1.0 Practice