A public REST service can be tested within Verj.io using the Test Rest Call button .
From the dialogue (see below) you can configure all the inputs (method, security, parameters, headers, body) of the HTTP request and submit to see the response.
Make a REST Resource with Endpoint getCode
Set the HTTP method to GET and the MIME Type to text/plain
Attach the following code to the Endpoint
switch (form.rest.getMethod()){ case "GET": form.rest.setResponseBody("Ticket Code: 10829XA"); form.rest.setResponseStatus(200); break; default: form.rest.setResponseStatus("405"); form.rest.setResponseBody({ msg: "No HTTP Method specificed or invalid HTTP Method used" }) break; }
Test the Public REST Service , then click Submit
See that it returns a 200 code.
Change the HTTP Method to POST
Retest the REST Service.
See that it returns a 405 code.