Adding FAQ - How do endpoints become available to the OBP API?

This commit is contained in:
Simon Redfern 2018-05-15 12:54:16 +02:00
parent 185c432ce9
commit ef2abb0961

50
FAQ.md Normal file
View File

@ -0,0 +1,50 @@
# FAQ
## How do endpoints become available to the OBP API?
In summary, we:
1) Check if the Version should be enabled by looking at the Props file.
2) Check which endpoints are included in each Version. (Probably contains endpoints that are also available in previous Versions).
3) Check which endpoints from this list should be enabled by looking at the Props.
4) Serve them
In more detail:
0) At boot time, Boot.scala is run
1) For each API version that a developer might call, we only run it if is enabled in Props e.g.
enableVersionIfAllowed(ApiVersion.v3_0_0)
2) As long as its not disabled in Props we add endpoints:
case ApiVersion.v3_0_0 => LiftRules.statelessDispatch.append(v3_0_0.OBPAPI3_0_0)
In this case we look into: /src/main/scala/code/api/v3_0_0/OBPAPI3_0_0.scala
This file defines which endpoints are made available to v3.0.0
Note that a version may have endpoints from the current and also previous versions e.g.from v3.0.0 and v2.1.0 and so on.
3) Then for the total endpoints available from each version, we check which endpoints should be enabled by looking at the Props for explicitly enabled endpoints or disabled endpoints.
For this to work we must pass the resource docs also.
e.g.
routes = ...
getAllowedEndpoints(endpointsOf2_2_0, Implementations2_2_0.resourceDocs)
getAllowedEndpoints(endpointsOf3_0_0, Implementations3_0_0.resourceDocs)
4) Once we have a final list of routes we serve them:
routes.foreach(route => {
oauthServe(apiPrefix{route}, findResourceDoc(route))
})