Skip to content

How to download JSON via API

This guide will help you download and save JSON data from Lootfabriq using the curl command-line tool.

Requirements

  • curl: Ensure curl is installed on your device. It’s a tool used to transfer data from or to a server.

Steps to download and save JSON

  1. Retrieve and save the latest completed report

Use the following command to download the latest completed report and save it as a JSON file:

Terminal window
curl -s -X GET https://api.lootfabriq.io/v1/api/instances/YOUR_INSTANCE_ID/reports/last-completed \
-H "x-lootf-token: YOUR_API_TOKEN" \
-O latest_report.json
  1. Retrieve and save a specific report

If you have a specific report ID, you can retrieve it and save it with this command:

Terminal window
curl -s -X GET https://api.lootfabriq.io/v1/api/instances/YOUR_INSTANCE_ID/reports/YOUR_REPORT_ID \
-H "x-lootf-token: YOUR_API_TOKEN" \
-O specific_report.json
  1. Download and save a specific JSON file

To download and save a specific JSON file from a report, use:

Terminal window
curl -s -L -X GET https://api.lootfabriq.io/v1/api/dictionaries/YOUR_FILE_PATH \
-H "x-lootf-token: YOUR_API_TOKEN" \
-O your_file.json

Example

Here is an example of downloading and saving JSON data:

Terminal window
# Retrieve and save the latest completed report
curl -s -X GET https://api.lootfabriq.io/v1/api/instancse/YOUR_INSTANCE_ID/reports/last-completed \
-H "x-lootf-token: YOUR_API_TOKEN" \
-O latest_report.json

or retrieve and save a specific report by ID:

Terminal window
curl -s -X GET https://api.lootfabriq.io/v1/api/instances/YOUR_INSTANCE_ID/reports/66acc87f0c93866a6b2a65cb \
-H "x-lootf-token: YOUR_API_TOKEN" \
-O specific_report.json

Example output:

{
"id": "66acc87f0c93866a6b2a65cb", // REPORT_ID
"dictionaries": [
{
"id": "66acc87f0c93866a6b2a65cc",
"template_id": "character",
"file": "2TVwo8Vsr48V54n42J4t/exp/1fpv75969ksmb/character.json" // YOUR_FILE_PATH
},
{
"id": "66acc87f0c93866a6b2a65cd",
"template_id": "quest",
"file": "2TVwo8Vsr48V54n42J4t/exp/1fpv75969ksmb/quest.json"
},
{
"id": "66acc87f0c93866a6b2a65ce",
"template_id": "resource",
"file": "2TVwo8Vsr48V54n42J4t/exp/1fpv75969ksmb/resource.json"
}
]
}
Terminal window
# Download and save the 'quest.json' file from the report
curl -s -L -X GET https://api.lootfabriq.io/v1/api/dictionaries/2TVwo8Vsr48V54n42J4t/exp/1fpv75969ksmb/quest.json \
-H "x-lootf-token: YOUR_API_TOKEN" \
-O quest.json