Examples ================== Below are examples of how to make a request to the API in different programming languages. ---- .. tab:: CURL .. code-block:: bash curl --location --request POST 'https://api.quantamatics.com/api/function/runFunction' \ --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \ --header 'Content-Type: application/json' \ --data-raw '{ "FunctionName": "Get Spend Metrics", "Args": { "report_id": "cc2c7f71-6cf3-4aab-a071-1754550b7ea8", "report_time_unit": "Year", "report_time_after": "2023-01-01", "shopper_generation": "Gen Z", "brands": [ "DICKS SPORTING GOODS" ] } }' .. tab:: Python .. code-block:: python import requests url = "https://api.quantamatics.com/api/function/runFunction" headers = { "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "Content-Type": "application/json" } payload = { "FunctionName": "Get Spend Metrics", "Args": { "report_id": "cc2c7f71-6cf3-4aab-a071-1754550b7ea8", "report_time_unit": "Year", "report_time_after": "2023-01-01", "shopper_generation": "Gen Z", "brands": [ "DICKS SPORTING GOODS" ] } } response = requests.post(url, json=payload, headers=headers) print(response.json()) .. tab:: JavaScript .. code-block:: javascript const url = "https://api.quantamatics.com/api/function/runFunction"; const headers = { "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "Content-Type": "application/json" }; const payload = { "FunctionName": "Get Spend Metrics", "Args": { "report_id": "cc2c7f71-6cf3-4aab-a071-1754550b7ea8", "report_time_unit": "Year", "report_time_after": "2023-01-01", "shopper_generation": "Gen Z", "brands": [ "DICKS SPORTING GOODS" ] } }; fetch(url, { method: "POST", headers: headers, body: JSON.stringify(payload) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error("Error:", error));