Skip to Content
VersõesUnstableAPISite

/unstable/site/imagens

Method: GET

Essa rota recebe as imagens que o usuário seleciona em seu painel de gerenciamento do site 

Ela aceita uma Query Strings obrigatória que pode ser um dos elementos do site:

types.ts
elemento: Elemento

Retorna a URL do elemento como string.

actions.ts
export async function getImage(elemento: Elemento) { const headers = new Headers(); headers.append("Authorization", `Bearer ${env.NONSTOP_TOKEN}`); const response = await fetch( `https://www.usenonstop.com/api/unstable/site/imagens?elemento=${elemento}`, { headers }, ); if (response.ok) return (await response.json()) as string; return null; }

/unstable/site/contato

Method: GET

Essa rota recebe as informações de contato que o usuário configura em seu perfil 

Retorna um objeto Contact

actions.ts
export async function getContact() { const headers = new Headers(); headers.append("Authorization", `Bearer ${env.NONSTOP_TOKEN}`); const response = await fetch("https://www.usenonstop.com/api/unstable/site/contato", { headers }); if (response.ok) return (await response.json()) as Contact; return { name: null, phone: null, whatsapp: null, email: null, address: null, socialMedias: [], creci: null }; }

/unstable/site/inscrever

Method: GET

Essa rota serve para que visitantes no site possam se inscrever para receber notícias, newsletters e campanhas por email do usuário. Os emails recebidos são armazenados automaticamente pela nonStop.

Retorna um Result

actions.ts
export async function subscribe(email: string) { const headers = new Headers(); headers.append("Authorization", `Bearer ${env.NONSTOP_TOKEN}`); const response = await fetch( `https://www.usenostop.com/api/unstable/site/inscrever?email=${email.toLowerCase()}`, { headers }, ); const json = (await response.json()) as Result; if (!json.ok) return { status: "error", error: json.error } as const; return { status: "success", message: json.message } as const; }

/unstable/site/slug

Method: GET

Essa rota serve para pegar o slug do usuário proprietário de determinado domínio customizado.

Retorna uma string com o slug caso tenha sucesso ou um {error: string} caso falhe.

actions.ts
export async function getSlug({ domain }: { domain: string }) { const headers = new Headers(); headers.append("Authorization", `Bearer ${env.NONSTOP_TOKEN}`); const response = await fetch( `${BASE_URL}/${VERSION}/site/slug?dominio=${domain}`, { headers, ...CONFIG }, ); if (response.ok) return (await response.json()) as string return (await response.json()) as { error: string } }

/unstable/site/criar-url

Method: GET

Essa rota serve para gerar uma url amigável.

Retorna uma string com a url gerada caso tenha sucesso ou um {error: string} caso falhe.

actions.ts
export async function createUrl({ original }: { original: string }) { const headers = new Headers(); headers.append("Authorization", `Bearer ${env.NONSTOP_TOKEN}`); const response = await fetch( `${BASE_URL}/${VERSION}/site/criar-url?${original}`, { headers, ...CONFIG }, ); if (response.ok) return (await response.json()) as string return (await response.json()) as { error: string } }

/unstable/site/recuperar-url

Method: GET

Essa rota serve para recuperar a url original à partir de uma url amigável.

Retorna uma string com a url original caso tenha sucesso ou um {error: string} caso falhe.

actions.ts
export async function retrieveUrl({ short }: { short: string }) { const headers = new Headers(); headers.append("Authorization", `Bearer ${env.NONSTOP_TOKEN}`); const response = await fetch( `${BASE_URL}/${VERSION}/site/recuperar-url?short=${short}`, { headers, ...CONFIG }, ); if (response.ok) return (await response.json()) as string return (await response.json()) as { error: string } }

/unstable/site/urls

Method: GET

Essa rota recebe todas as URLs das páginas dos imóveis. Pode ser usada para criação de sitemap.

actions.ts
export async function getUrls(slug: string): Promise<string[]> { const headers = new Headers(); headers.append("Authorization", `Bearer ${env.NONSTOP_TOKEN}`); const response = await fetch( `${BASE_URL}/${VERSION}/site/urls?slug=${slug}`, { headers, ...CONFIG, }, ); if (response.ok) return (await response.json()) as string[]; return []; }

Last updated on