Adding Resources and Methods
A REST API is built around the concept of resources. A resource is any information that can be named such as a document or an image, a temporary service such as today’s weather in Los Angeles, a collection of other resources, a non-virtual object, and so on. In REST, a resource is always associated with a set of methods that operate it. The supported methods are
After adding the API, you can model the API by adding resources and methods to it.
To add resources and methods, complete these steps:
- In the left Resource section, click Add Resource.
In the displayed Add a resource and methods dialog, enter a resource path that starts with a slash, and select one or more methods. Click Save.
(Optional) In the left Resource section, click an added method and click to add a tag for the operation.
Tags can be used for logical grouping of operations by resources or any other qualifier. By default, no tag is added for each operation.
(Optional) In the Method Information section, click the Summary or Description links to add a description for the selected operation. Note that the maximum size of the Summary field is 120 characters. You can also click ID to change the method’s predefined ID. Note that in an older API Specification, a method has no ID. You can go to the API Spec edit page and that the ID can be generated.
Use the following options to edit an added resource:
Move the mouse pointer over the resource and click Edit to change the resource path. Ensure that the resource path is unique.
Move the mouse pointer over the resource and click to delete the resource.
Click the plus icon below the methods to add a new method.
Use the following options to edit an added method:
- Move the mouse pointer over the method and click Change method to change the method. The method that is grayed out indicates that the method is already added.
Move the mouse pointer over the method and click to delete the method.