This project is a Deno application that exports data from Shopware.
The script:
- Accepts the base API URL, API key, and API secret as command-line arguments.
- Authenticates via an authorization endpoint using the provided credentials.
- Retrieves a Bearer token and uses it to fetch data from the main API endpoint.
- Saves the data in
output.csv
as a CSV file.
Ensure that you have Deno installed. You can install Deno by following the instructions on the official Deno site.
First create an integration in Shopware to use for the credentials.
The application takes three command-line arguments:
- BASE_API_URL: The base URL of the API (e.g., http://localhos:8000)
- API_KEY: Copy from integration
- API_SECRET: Copy from integration
To run the application, use the following command format:
deno run --allow-net --allow-read --allow-write main.ts BASE_API_URL API_KEY API_SECRET
Replace BASE_API_URL, API_KEY, and API_SECRET with actual values for your API.
After successful execution, you will find an output.csv file in the directory, containing the data retrieved from the API.
Deno allows you to compile your TypeScript/JavaScript code into an executable binary for easier distribution. You can compile this project into an executable as follows:
deno compile --allow-net --allow-read --allow-write main.ts
To run the compiled binary, use the following command format:
./EXECUTABLE_NAME BASE_API_URL API_KEY API_SECRET
This command does not require deno run or specific permissions since they are built into the binary.