MPMinus

 view release on metacpan or  search on metacpan

lib/MPMinus/REST.pm  view on Meta::CPAN


B<Note:> PUT replaces an existing entity. If only a subset of data elements are provided, the rest
will be replaced with empty or null.

=head3 PATCH

Update only the specified fields of an entity at a URI. A PATCH request is neither safe nor
idempotent (RFC 5789). That's because a PATCH operation cannot ensure the entire resource
has been updated.

    PATCH /addresses/1

=head3 DELETE

Request that a resource be removed; however, the resource does not have to be removed immediately.
It could be an asynchronous or long-running request.

Delete an address with an ID of 1:

    DELETE /addresses/1

=head2 HTTP 1.1 STATUS CODES

=over 8

=item 1XX - informational

    100 HTTP_CONTINUE                        Continue
    101 HTTP_SWITCHING_PROTOCOLS             Switching Protocols

=item 2XX - success

    200 HTTP_OK                              OK
    201 HTTP_CREATED                         Created
    202 HTTP_ACCEPTED                        Accepted
    203 HTTP_NON_AUTHORITATIVE               Non-Authoritative Information
    204 HTTP_NO_CONTENT                      No Content
    205 HTTP_RESET_CONTENT                   Reset Content
    206 HTTP_PARTIAL_CONTENT                 Partial Content

=item 3XX - redirection

    300 HTTP_MULTIPLE_CHOICES                Multiple Choices
    301 HTTP_MOVED_PERMANENTLY               Moved Permanently
    302 HTTP_MOVED_TEMPORARILY               Found
    303 HTTP_SEE_OTHER                       See Other
    304 HTTP_NOT_MODIFIED                    Not Modified
    305 HTTP_USE_PROXY                       Use Proxy
    306                                      (Unused)
    307 HTTP_TEMPORARY_REDIRECT              Temporary Redirect

=item 4XX - client error

    400 HTTP_BAD_REQUEST                     Bad Request
    401 HTTP_UNAUTHORIZED                    Unauthorized
    402 HTTP_PAYMENT_REQUIRED                Payment Required
    403 HTTP_FORBIDDEN                       Forbidden
    404 HTTP_NOT_FOUND                       Not Found
    405 HTTP_METHOD_NOT_ALLOWED              Method Not Allowed
    406 HTTP_NOT_ACCEPTABLE                  Not Acceptable
    407 HTTP_PROXY_AUTHENTICATION_REQUIRED   Proxy Authentication Required
    408 HTTP_REQUEST_TIMEOUT                 Request Timeout
    409 HTTP_CONFLICT                        Conflict
    410 HTTP_GONE                            Gone
    411 HTTP_LENGTH REQUIRED                 Length Required
    412 HTTP_PRECONDITION_FAILED             Precondition Failed
    413 HTTP_REQUEST_ENTITY_TOO_LARGE        Request Entity Too Large
    414 HTTP_REQUEST_URI_TOO_LARGE           Request-URI Too Long
    415 HTTP_UNSUPPORTED_MEDIA_TYPE          Unsupported Media Type
    416 HTTP_RANGE_NOT_SATISFIABLE           Requested Range Not Satisfiable
    417 HTTP_EXPECTATION_FAILED              Expectation Failed

=item 5XX - server error

    500 HTTP_INTERNAL_SERVER_ERROR           Internal Server Error
    501 HTTP_NOT IMPLEMENTED                 Not Implemented
    502 HTTP_BAD_GATEWAY                     Bad Gateway
    503 HTTP_SERVICE_UNAVAILABLE             Service Unavailable
    504 HTTP_GATEWAY_TIME_OUT                Gateway Timeout
    505 HTTP_VERSION_NOT_SUPPORTED           HTTP Version Not Supported

=back

See L<Apache Constants|http://perl.apache.org/docs/2.0/api/Apache2/Const.html>

=head2 MEDIA TYPES

The C<Accept> and C<Content-Type> HTTP headers can be used to describe the content being sent or requested
within an HTTP request. The client may set C<Accept> to C<application/json> if it is requesting a
response in JSON. Conversely, when sending data, setting the C<Content-Type> to
C<application/xml> tells the client that the data being sent in the request is XML.

=head1 CONFIGURATION

The simplest configuration of MPMinus REST server requires a few lines in your httpd.conf:

    PerlModule MyApp::REST
    PerlOptions +GlobalRequest +ParseHeaders
    <Location />
        PerlInitHandler MyApp::REST
    </Location>

The <Location> section routes all requests to the MPMinus REST handler,
which is a simple way to try out MPMinus REST

=head1 METHODS

=head2 handler

The main Apache mod_perl2 entry point. This method MUST BE overwritten in your class!

    sub handler : method {
        my $class = (@_ >= 2) ? shift : __PACKAGE__;
        my $r = shift;

        # ... preinit statements ...

        return $class->init($r, arg1 => "foo", arg2 => "bar");
    }

=head2 init



( run in 0.509 second using v1.01-cache-2.11-cpan-71847e10f99 )