Send an command to the material to refresh all the medias on it (synchronise server & material)
The command need +-2 min to be executed by the material
The default refresh media is every 10 min, but if for some reason you want to force the refresh, you can execute the following.
from os import environ
from smart_prospective_api import SPApi, APIError
import json
PUBLIC_KEY = "pub_XXXXX"
PRIVATE_KEY = "sec_XXXXX"
try:
# Setup the API credencial (do not perform any request at this moment)
# Note: The public key starts by "pub_" & The secret key starts by "sec_"
sp_api = SPApi(PUBLIC_KEY, PRIVATE_KEY)
# REFRESH the medias in material (return the status: True or False)
sp_api.refresh_material(sp_api.get_materials()[0]["code"])
sp_api.logout() # Logout the account, more safe to use it, to avoid potential attacks
except APIError as e:
print(f"Failure using the Smart Prospective API: {e}")
curl --location --request POST 'https://app.smartprospective.com/api/materials/refresh' \
--form 'token="XXXXXX"' \
--form 'material_code="MaterialCodeX"'