Extract APIs from source code using our Docker based CLI
You can extract APIs from your code repositories using our Docker based CLI.
How to use
Prepare the following variables:
AKTO_SYNC- Set this toTRUEif you want the CLI to import the extracted APIs into the Akto dashboardAKTO_API_KEY- Go to My accounts > Settings > Integrations > Akto API > Generate token. Copy the token generated.AKTO_DASHBOARD_URL- URL of your Akto dashboard. Please ensure the docker container can access the Akto dashboard,API_COLLECTION_NAME- The API collection name into which you want to import the extracted APIs. Ensure that this collection exists.GITHUB_REPOSITORY- The name of the Github repository to be used for source location links.GITHUB_BRANCH- The branch of the Github repository to be used for source location links.
To extract APIs from a local code repository, run the following docker run command in a terminal:
docker run -it --rm -v "$(pwd)":/usr/source_code \
aktosecurity/akto-puppeteer-replay:doom_latest cli extract \
--IS_DOCKER="true"Explanation:
-it- enables interactive terminal input, allowing command line interaction.--rm- automatically removes container after it exits.-v "$(pwd)":/usr/source_code- mounts current directory to /usr/source_code in the container.
To import the extracted APIs into an API collection in Akto dashboard, run the following docker run command in a terminal:
docker run -it --rm -v "$(pwd)":/usr/source_code \
aktosecurity/akto-puppeteer-replay:doom_latest cli extract \
--IS_DOCKER="true" \
--AKTO_SYNC="true" \
--AKTO_DASHBOARD_URL="AKTO_DASHBOARD_URL" \
--AKTO_API_KEY="AKTO_API_KEY" \
--API_COLLECTION_NAME="juice_shop_demo"To add source code links to the extracted APIs, run the following docker run command in a terminal:
docker run -it --rm -v "$(pwd)":/usr/source_code \
aktosecurity/akto-puppeteer-replay:doom_latest cli extract \
--IS_DOCKER="true" \
--AKTO_SYNC="true" \
--AKTO_DASHBOARD_URL="AKTO_DASHBOARD_URL" \
--AKTO_API_KEY="AKTO_API_KEY" \
--API_COLLECTION_NAME="juice_shop_demo" \
--GITHUB_REPOSITORY="akto-api-security/juice-shop" \
--GITHUB_BRANCH="master"Results
The API collection as specified by the
API_COLLECTION_NAMEvariable can be viewed in the Akto dashboard to review the APIs extracted from source code.
Last updated
Was this helpful?