Skip to content
  • There are no suggestions because the search field is empty.

API: Buy it now Link & Price

The following article will cover how to use the API to configure Buy it Now Links and Price.

Adding a custom buy it now link to a report

By default, a product will use the site-wide buy it now settings.

This can be set by clicking on “Global buy it now link” in the related actions of the reports list page.

🔔 Note: See the "Buy it Now" Button Guide for more information.

In order to set the buy it now link for a specific report, you should PUT to ~/api/v1/libraries/reports/products/{productCode}/buy-it-now-link.

If you want to update the price and price label, then you will need to GET from ~/api/v1/libraries/reports/products/{productCode}.

You can then take the result and update the price information. Using this, you can PUT to ~/api/v1/libraries/reports/products/{productCode}.

See example below: 

Bash

#!/bin/bash 
baseUrl=$1
productCode=$2
enabled=$3
url=$4
price=$5
priceLabel=$6

# Update the buy it now information
body=$(jo enabled=$enabled url=$url)
curl -s -X PUT "${baseUrl}api/v1/libraries/reports/products/${productCode}/buy-it-now-link" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic $authHeader" -d "${body}"

# Get the product information to update the product

priceDetails=$(jo price=$price priceLabel=$priceLabel)
response=$(curl -s -X GET "${baseUrl}api/v1/libraries/reports/products/${productCode}" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic $authHeader")
body=$(echo $response | jq ". + ${priceDetails}")
curl -X PUT "${baseUrl}api/v1/libraries/reports/products/${productCode}" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic $authHeader" -d "${body}"