Cadastra ou atualiza as credenciais do aplicativo do ERP para o projeto.
const url = 'https://api.payle.me/api/integrations/erps/bling/integration';const options = { method: 'PUT', headers: { 'X-Customer-Id': '<X-Customer-Id>', 'X-Customer-Secret': '<X-Customer-Secret>', 'Content-Type': 'application/json' }, body: '{"credentials":{"clientId":"SEU_CLIENT_ID_AQUI","clientSecret":"SEU_SEGREDO_AQUI","redirectUri":"https://api.payle.me/api/integrations/erps/bling/oauth/callback"},"syncFreqMin":60}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.payle.me/api/integrations/erps/bling/integration \ --header 'Content-Type: application/json' \ --header 'X-Customer-Id: <X-Customer-Id>' \ --header 'X-Customer-Secret: <X-Customer-Secret>' \ --data '{ "credentials": { "clientId": "SEU_CLIENT_ID_AQUI", "clientSecret": "SEU_SEGREDO_AQUI", "redirectUri": "https://api.payle.me/api/integrations/erps/bling/oauth/callback" }, "syncFreqMin": 60 }'Grava clientId, clientSecret e redirectUri (Tiny/Olist também issuer e webhookToken) antes do OAuth. Tokens são preenchidos pelo callback: não os envie. credentials é objeto de strings sem lista de chaves validada aqui. syncFreqMin inteiro, mínimo 5. Integração nova é retida em status: paused até o teste de conexão passar (o teste roda ao salvar). Retorno sem segredos. Escopo: integrations.manage. Resposta 200 (PUT).
Authorizations
Seção intitulada “Authorizations”Parameters
Seção intitulada “Parameters”Path Parameters
Seção intitulada “Path Parameters”Id do plugin de ERP. Disponíveis: bling, tiny, olist.
Request Bodyrequired
Seção intitulada “Request Bodyrequired”object
Bling: clientId, clientSecret, redirectUri. Tiny/Olist: também issuer e webhookToken. Não envie tokens.
object
object
Example
{ "credentials": { "clientId": "SEU_CLIENT_ID_AQUI", "clientSecret": "SEU_SEGREDO_AQUI", "redirectUri": "https://api.payle.me/api/integrations/erps/bling/oauth/callback" }, "syncFreqMin": 60}Responses
Seção intitulada “Responses”Estado depois da gravação.
object
Example
{ "id": "55555555-5555-4555-8555-555555555555", "projectId": "11111111-1111-4111-8111-111111111111", "erp": "bling", "status": "paused", "syncFreqMin": 60, "lastSyncAt": null, "lastSyncStatus": null}Corpo inválido (credentials ausente, syncFreqMin abaixo de 5). Em produção a mensagem é Bad Request.
Envelope de erro da API. trace_id so quando ha span ativo.
object
object
Example
{ "error": { "code": "VALIDATION_ERROR" }}Cabeçalhos ausentes (X-Customer-Id e X-Customer-Secret são obrigatórios) ou credencial inválida (Credenciais inválidas). Código UNAUTHENTICATED. No edge, sem Bearer de sessão a chamada nem chega ao core (EdgeError).
Envelope de erro da API. trace_id so quando ha span ativo.
object
object
Example
{ "error": { "code": "UNAUTHENTICATED", "message": "Credenciais inválidas" }}Credencial sem o escopo exigido pela rota (Escopo <escopo> não permitido).
Envelope de erro da API. trace_id so quando ha span ativo.
object
object
Example
{ "error": { "code": "FORBIDDEN", "message": "Escopo checkout.create não permitido" }}ERP inexistente.
Envelope de erro da API. trace_id so quando ha span ativo.
object
object
Example
{ "error": { "code": "VALIDATION_ERROR" }}Limite de requisições excedido (RATE_LIMITED). Espere o Retry-After.
Envelope de erro da API. trace_id so quando ha span ativo.
object
object
Example
{ "error": { "code": "VALIDATION_ERROR" }}