Use the System.RestReponse class to pass response data from an Apex RESTful web service method that is defined using one of the REST annotations.
The following are properties for RestResponse.
public Blob responseBody {get; set;}
Type: Blob
The response is either the serialized form of the method return value or it's the value of the responseBody property based on the following rules:
public Integer statuscode {get; set;}
Type: Integer
The following are valid response status codes. The status code is returned by the RestResponse.statusCode property.
Status Code | Description |
---|---|
200 | OK |
201 | CREATED |
202 | ACCEPTED |
204 | NO_CONTENT |
206 | PARTIAL_CONTENT |
300 | MULTIPLE_CHOICES |
301 | MOVED_PERMANENTLY |
302 | FOUND |
304 | NOT_MODIFIED |
400 | BAD_REQUEST |
401 | UNAUTHORIZED |
403 | FORBIDDEN |
404 | NOT_FOUND |
405 | METHOD_NOT_ALLOWED |
406 | NOT_ACCEPTABLE |
409 | CONFLICT |
410 | GONE |
412 | PRECONDITION_FAILED |
413 | REQUEST_ENTITY_TOO_LARGE |
414 | REQUEST_URI_TOO_LARGE |
415 | UNSUPPORTED_MEDIA_TYPE |
417 | EXPECTATION_FAILED |
500 | INTERNAL_SERVER_ERROR |
503 | SERVER_UNAVAILABLE |
The following are instance methods for RestResponse.
public Void addHeader(String name, String value)
Type: Void