8 FAQ
8.1 How to expose a new resource (endpoint) in your public API?
In order to expose a new resource in your public API, you should add the corresponding mapping description in your mappings configuration file and then invoke ApiFest online reload (see chapter 3.11) -
GET /apifest-reload.
You can create the mapping description by annotating your code and use the ApiFest Doclet to generate the new version of the mappings configuration file/s (see chapter
3.7).
8.2 How to add a scope to an existing endpoint?
You should add the appropriate scope to the mapping annotation
@apifest.scope if you use the ApiFest Doclet (see chapter
3.7) or add the new scope to the scope attribute of the corresponding endpoint tag in your mappings configuration file (see chapter
3.2). Use space as a separator.
8.3 How to apply changes in the mappings configuration files online?
You can reload the mappings in the ApiFest Mapping Server by calling the following service:
GET /apifest-reload
The service will load all mappings configuration files from the mappings directory, all actions/filters from the custom.jar and global errors file.
8.4 How to implement a new request transformation (action)?
A request transformation class should extend
com.apifest.api.BasicAction class - that's the only restriction. The transformation that will occur in the new action class is up to you. You need to add the new class in the
custom.jar (see chapter
3.4).
8.5 How to implement a new response transformation (filter)?
A response transformation class should extend
com.apifest.api.BasicFilter class - that's the only restriction. The transformation that will occur in the new filter class is up to you. You need to add the new class in the
custom.jar (see chapter
3.5).
8.6 How to add a new api version?
Just change the value of the
mapping.version in the corresponding pom.xml file or the environment variable. That will generate mappings for that version. The result will be a mappings configuration file that contains the new API version in the
version attribute of the
mappings tag. For more details, see chapter
3.12.
8.7 How to add a new endpoint to an existing scope?
That is the same as adding a new scope to an existing endpoint - just add the existing scope to the new endpoint. You can do that directly in the mappings configuration file or you can change the
apifest.scope annotation in your Javadoc and then generate a new mappings configuration file by using the ApiFest Doclet (see chapter
3.7).
8.8 Is it possible to add several actions or filters to an endpoint?
No but you can always re-use some existing functionality using Java language inheritance.