Verificar script
curl --request GET \
--url https://api.upag.io/v1/apps/{appId}/script \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.upag.io/v1/apps/{appId}/script', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/apps/{appId}/script';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Apps
Verificar script
Confere se o script de checkout está instalado e acessível na loja Shopify
GET
https://api.upag.io
/
v1
/
apps
/
{appId}
/
script
Verificar script
curl --request GET \
--url https://api.upag.io/v1/apps/{appId}/script \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.upag.io/v1/apps/{appId}/script', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/apps/{appId}/script';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Compara o ScriptTag esperado com o que existe na loja e testa se a URL do script responde. Também sincroniza o
scriptTagId guardado na config. Só apps shopify.
Permissão: app.read (chave secreta).
Endpoint
curl https://api.upag.dev/v1/apps/c8d9e0f1-a2b3-4c4d-9e5f-6a7b8c9d0e12/script \
-H "Authorization: Bearer sk_test_your_api_key"
import { Upag } from 'upag';
const upag = new Upag('sk_test_your_api_key');
const result = await upag.apps.verifyScript('c8d9e0f1-a2b3-4c4d-9e5f-6a7b8c9d0e12');
Em produção use
https://api.upag.io/v1 com sk_live_....Parâmetros
string (uuid)
required
ID do app Shopify.
Resposta
200 OK
Response
{
"status": "ok",
"installed": true,
"expectedSrc": "https://assets.upag.io/v1/shopify/checkout.min.js?pk=pk_live_...&api=https%3A%2F%2Fapi.upag.io%2Fv1%2Fcheckout",
"found": [
{ "id": "175450112345", "src": "https://assets.upag.io/v1/shopify/checkout.min.js?pk=pk_live_...&api=https%3A%2F%2Fapi.upag.io%2Fv1%2Fcheckout" }
],
"reachability": { "ok": true, "status": 200, "reason": null }
}
status pode ser:
ok— instalado, com a URL esperada e acessível (installed: true).not_installed— nenhum ScriptTag encontrado.stale_src— existe, mas com URL diferente da esperada; reinstale.duplicated— mais de um ScriptTag; reinstale para deixar só um.unreachable— a URL do script não é acessível (reachability.reasonindica o motivo, por exemplonot_https,private_host,bad_status,not_javascript,dns_not_foundouconnection_refused).
404 (APP_NOT_FOUND); 400 (APP_SCRIPT_NOT_SUPPORTED em apps que não são Shopify, SHOPIFY_CREDENTIALS_INCOMPLETE).