-
Notifications
You must be signed in to change notification settings - Fork 762
Web services
The OpenGrok web application provides a REST API under path /api/v1/
.
For Indexer and Python scripts to work correctly, the URI of the web application needs to be specified with -U
option. (For instance: -U http://localhost:8080/source
).
For the API documentation go to https://opengrok.docs.apiary.io/
Some of the API endpoints require authorization (which assumes authentication), some of the endpoints need to be accessed either via localhost or with API Bearer token.
To use an API token, it needs to be configured in the web application first (see authenticationTokens
in https://github.com/oracle/opengrok/wiki/Webapp-configuration#configuration-tunables). The web app configuration can have multiple API tokens. Then it can be used from the indexer (which uploads the configuration at the end of the indexing if the -U option is used) using the --token
command line option. The Python tools allow to set arbitrary HTTP headers when performing API calls using the -H/--header option so this can be used to specify the API token as well. The opengrok-sync
program allows to set the HTTP headers also in the configuration file.