• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

REST API Tutorial

  • REST
  • JSON
  • Dark Mode
Home / HTTP Status / HTTP Status 200 (OK)

HTTP Status 200 (OK)

The HTTP Status 200 (OK) status code indicates that the request has been processed successfully on server. The response payload depends on HTTP method which was selected for request.

HTTP Status 200 – Response Payload

HTTP MethodResponse Payload
GETAn entity corresponding to the requested resource is sent in the response.
HEADResponse has only HTTP header fields and no payload is sent in response.
POSTResponse generally contain information about progress status representation or result of action that was performed in request.
PUTProgress status representation of request is sent in response.
DELETEProgress status representation of request is sent in response.
OPTIONSA list of valid request methods associated with the resource using Allow header. e.g.

Allow: HEAD, GET, OPTIONS
Content-Length: 18
Content-Type: text/plain;charset=UTF-8
Date: Thu, 06 Apr 2017 06:43:59 GMT
Server: Apache-Coyote/1.1
TRACEA representation of the request message as received by the end server.

Important Facts

  • A 200 response always has a payload, though an origin server MAY generate a payload body of zero length or empty payload.
  • If server does not want to send any payload in response, then it should send HTTP status 204 (No Content) instead.
  • By default, 200 (OK) response (header and payload) are cacheable. If chaching needs to be overridden then response must include cache respective cache headers.

Reference: 200 OK

Was this article helpful?

Share this:

  • Twitter
  • Facebook
Previous Tutorial:
Next Tutorial:
HTTP Status 201 (Created)

Reader Interactions

Comments

  1. Sap M says

    September 19, 2019 at 8:08 pm

    Hi , Am trying to create a new account and am getting JSON response as ”

    ” in Rest service.
    RAW tab has the following information” HTTP/1.1 200 OK
    Date: Thu, 19 Sep 2019 20:02:31 EST
    Content-Length: 14
    Content-Type: application/json
    X-UA-Compatible: IE=edge,chrome=1
    ”

    How can I see my requested account number in the response field.

    Reply
    • Admin says

      September 19, 2019 at 9:28 pm

      Check response body.

      Reply
  2. Jim says

    September 10, 2019 at 6:38 pm

    Do you have to manually return a 200 response code or is this handled by the server?
    If manual, how do you return the code?

    Reply
    • Admin says

      September 12, 2019 at 5:22 pm

      You can find an example in JAX-RS example.

      Reply
  3. Kuldip Shah says

    June 19, 2019 at 8:52 pm

    Hi, For response code 200, Can the body use “one of” entity? i.e. in some condition, 200 will receive Entity1 and other condition, 200 will receive Entity2?

    Reply
    • Admin says

      June 20, 2019 at 3:34 am

      Yes, there is no such limitation. Make sure you update the API docs.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Search Tutorials

Learn REST

  • What is REST?
  • REST Constraints
  • REST Resource Naming Guide

Guides

  • Caching
  • Compression
  • Content Negotiation
  • HATEOAS
  • Idempotence
  • Security Essentials
  • Versioning
  • Statelessness in REST APIs

Tech – How To

  • REST API Design Tutorial
  • Create REST APIs with JAX-RS

FAQs

  • PUT vs POST
  • N+1 Problem
  • ‘q’ Parameter

Resources

  • What is an API?
  • Comparing SOAP vs REST APIs
  • HTTP Methods
  • Richardson Maturity Model
  • HTTP Response Codes
    • 200 (OK)
    • 201 (Created)
    • 202 (Accepted)
    • 204 (No Content)
    • 301 (Moved Permanently)

Footer

References

  • The dissertation by Roy Thomas Fielding
  • Uniform Resource Identifier (URI, URL, URN) [RFC 3986]
  • Internet MediaTypes
  • Web Application Description Language (WADL)

Meta Links

  • About
  • Contact Us
  • Privacy Policy

Blogs

  • How To Do In Java

Copyright © 2020 · restfulapi.net · All Rights Reserved. | Sitemap