SDK e integrazioni
MostlyRender è una semplice API REST — usala da qualsiasi linguaggio con un client HTTP. Forniamo anche un SDK Python e un’app Zapier.
# Python
Zero dipendenze (solo stdlib), Python 3.8+.
pip install mostlyrender
from mostlyrender import MostlyRender
mr = MostlyRender("mr_live_…") # or base_url="https://mostly-render-api.web.app"
mr.render("tpl_abc", modifications={"title": "Hello"}) # → { id, url, output }
mr.render_batch(template_id="tpl_abc", items=[{"title": "A"}]) # → { results, count, ok }
mr.screenshot("https://stripe.com", full_page=True) # → { id, url, output }
mr.list_templates() # → { templates: [...] }
mr.get_account() # → { plan, email, display_name }
job = mr.render_async("tpl_abc", output="pdf", webhook_url="https://your.app/hook")
final = mr.wait_for_render(job["id"]) # polls until done
Gli errori generano MostlyRenderError con .status e .body. Vedi Errori.
# Zapier
Connetti MostlyRender in Zapier con la tua chiave API (convalidata rispetto a GET /v1/account).
Azioni:
- Renderizza un template — compila i parametri di modifica del template e ricevi un URL immagine.
- Cattura uno screenshot di un URL — acquisisci uno screenshot di una pagina.
- I template sono offerti come menu a discesa (gestito da
GET /v1/templates).
# cURL / REST
Qualsiasi cosa gli SDK facciano è una chiamata REST diretta:
curl https://api.mostlyrender.com/v1/renders \
-H "Authorization: Bearer mr_live_…" \
-H "Content-Type: application/json" \
-d '{ "template": "tpl_abc", "modifications": { "title": "Hello" } }'
Il contratto completo leggibile dalla macchina è la Specifica OpenAPI — importala nel tuo generatore di client o in Postman. Sfoglialo in modo interattivo in Riferimento API.