Update specific webviewtemplate requirements
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)
# Requirements sample
data = {"data1": "test1",
"data2": "test2"}
# Update
updated_webviewtemplate = sp_api.update_requirements_webviewtemplates(code="the_webviewtemplate_code", requirements=json.dumps(data)) # Update the webviewtemplate (using the webviewtemplate code)
print(f"The webviewtemplate: {updated_webviewtemplate['name']} have been updated")
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/webviewtemplates/edit/<WEBVIEWTEMPLATE_CODE>' \
--form 'token="XXXXXX"' \
--form 'requirements="{}"'
# replace <WEBVIEWTEMPLATE_CODE> with the actual webviewtemplate code (If Get webviewtemplates)