A simple NodeJS script to re-publish APIs using WSO2 API Manager REST APIs.
Inrtoduced to overcome Solr indexing problems in WSO2 API Manager to re-publish APIs (re-index). Supports WSO2 API Manager
>= v2.5.0
apim-3.x-branch contains the implementation for API Manager servers 3.x family. Please read the execution flow and the README to understand the execution plan.
|- bin
|- repository
|- conf
|- deployment.toml : configurations of api-republish
|- logs
|- api-republish-error.log : error level logs
|- api-republish.log : combined level logs
|- server.js
-
Install
NodeJS
in your environment (recommended to usev11.14.0
) -
Extract the attached zip and execute the following command from the root folder to install all package dependencies
npm install
-
Navigate to
/repository/conf
and editdeployment.toml
to change thehostname
,port
and etc. values -
To enable debug logs and responses recieved from the server, navigate to
/repoistory/conf/deployment.toml
and settrue
for bothdebug
andresponse
under the[debug]
section -
Execute the following command from the root folder to execute the script
node server
Execute
npm link
to link theapi-republish
package within your local enviroment so that we can invoke the package directly by executingapi-republish
command without executing thenode server
from the root directory
Configuration | Description | Default |
---|---|---|
hostname | Hostname of the Publisher node | localhost |
port | Port of the Publisher node | 9443 |
km_hostname | Hostname of the Key Manager node | localhost |
km_port | Port of the Key Manager node | 9443 |
version | WSO2 API Manager REST API version | v0.14 |
expand | Expand query parameter | true |
limit | Limit query parameter | 200 |
offset | Offset query parameter | 0 |
query | Query query parameter | status:PUBLISHED |
username | Username of Admin user | admin |
password | Password of Admin user | admin |
Configuration | Description | Default |
---|---|---|
callbackUrl | Callback URL for DCR | www.google.lk |
clientName | Name of the DCR | rest_api_store |
owner | Owner of the DCR | admin |
grantType | Grant Types allowed | password refresh_token |
saasApp | Saas App | true |
Configuration | Description | Default |
---|---|---|
grant_type | Grant Type used for the Access Token generation | password |
scope | Scopes | apim:subscribe apim:api_create apim:api_view apim:api_publish |
Configuration | Description | Default |
---|---|---|
debug | Enable to print Debug logs of the execution flow | false |
response | Enable to print the Responses retrieved from the Server during the execution | false |
- Registers a dynamic client
- Generates the Access Token using Admin credentials
- Lists all the available APIs using the Publisher API (with expanded info)
- Filters the APIs under the following conditions
- Status = Published
- Visibility = Restricted
- Publishes the filtered APIs