mcorest_api_register_service

Register the URL path and the handler routine with the mcorest core library.

For an overview see page Web Services

Prototype

 
  MCO_RET mcorest_api_register_service(mcorest_h rest, 
                        const char *path, 
                        mcorest_api_handler_fn h, 
                        void *ctx, 
                        int allow_partial_match);
 

Arguments

rest Server instance handle
path Service's URL path
h Request handler routine; see mcorest_api_handler_fn
ctx Context pointer to be passed to the handler
allow_partial_match If not 0, the handler will be passed requests for both path and its children (e.g. handler for "/base" will also receive "/base/child" requests). Otherwise, only exact matches will be accepted * (e.g. "/base", "/base/" or "/base?query").

Description

Registers the REST service at the specified path. The registration order matters: the paths should be registered from the most to the least specific. For example: "/base/child" should come before "/base".

Return Codes

MCO_S_OK = 0 Success
MCO_E_REST_INUSE A service has already been registered with the path
MCO_E_REST_* Any of the Web Services Error Codes

Files

Header file:
mcorestapi.h
Source file:
mcorestapi.c
Library:
libmcorest.a