Adding Custom Properties to APIs
Usually, APIs have a pre-defined set of properties such as the name, version, context, etc. However, there may be instances where you want to add specific custom properties to your API. You can do this in either of the following ways:
When adding custom properties, note the following:
Property name should be unique.
Property name should not contain spaces.
Property name cannot be case sensitive.
Property name cannot be any of the following as they are reserved keywords: provider, version, context, status, description, subcontext, doc, lcState, name, tags.
Once custom properties have been added, you can search for APIs using custom property values.
Add custom properties via the API Publisher
- Log in to the API Publisher as an API creator using the following URL:
https://<localhost>:9443/publisher
. - Create a new API or choose to edit an existing API.
- In the Manage tab, expand the API Properties area, enter a custom property name and value (e.g. property name: environment, property value: preprod) and click the plus (+) sign to add it.Â
- Save the API.
Add custom properties via the REST API
You can use the existing REST API to add a new API with custom properties. Add the following element to the request body including the relevant properties,
"additionalProperties : {"environment": "preprod", "secured": "true"}
Search using custom properties
You can use the following format to search for an API using the custom properties:
<property_name>:<property_value>
For example, if you want to search for the environment property with a specific value (e.g. preprod), you can search as shown below: