The route describes the path component of the URL that will be used to address your end point. It does not describe any query parameters or request body parameters. The route object can have the following properties:
|
|
Let's look at a few examples:
{ "endpoints": { "ExamplesGetAllProducts": { "route": { "httpMethod": "GET", "segments": { "examples": { "isLiteral": true, "type": "string" }, "products": { "isLiteral": true, "type": "string" } } } //remaining metadata omitted } } } |
The above example only has literals for segments, so it would create a GET end point at /examples/product
{ "endpoints": { "ExamplesGetSingleProduct": { "route": { "httpMethod": "GET", "segments": { "examples": { "isLiteral": true, "type": "string" }, "products": { "isLiteral": true, "type": "string" }, "productId" : { "isLiteral" : false, "type" : "long" } } } //remaining metadata omitted } } } |
The above example has a non-literal segment named productId that is a long. You could issue a GET to /examples/products/1 or /example/products/20213, but you could not issue a GET to /examples/products/SampcoHat.