Adding Custom Properties to APIs¶
Usually, APIs have a predefined 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.
After the custom properties have been added, you can search for APIs using custom property values.
Add custom properties via the API Publisher¶
-
Sign in to the API Publisher as an API creator using the following URL:
https://<localhost>:9443/publisher
-
Create a new API or edit an existing API.
-
Click Properties and click ADD NEW PROPERTY.
-
Enter a custom property name and value (e.g., property name: environment, property value: preprod), mark Developer Portal visibility as appropriate and click ADD to add it.
-
Click SAVE to save the API.
Add custom properties via the REST API¶
Use the existing REST API to add a new API and in order to add the API with custom properties make sure to 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) in the Publisher, you can search as shown below:
When you click on the name of the API in the above screen, the respective API Overview page appears. Click on the Properties tab to list the API properties that you added.
Top