Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
Creating tickets using Zendesk api with React

I working on intergrating a react app with the zendesk api for creating support tickets. Till now i have completed the form flow, but when i making the request to the zendesk api i am getting 401. I am using the api_key approach for this. I am fairly new to zendesk, if anyone can help me regarding that. Here is my code after user clicks submit.

const onSubmit = async () => {
    try {
      console.log('setInfo', info)
      const data = { request: { subject: 'test', comment: { body: 'testdesc' } } }

      const user = 'test@test.com'
      const api_token = 'some_api_key'
      const url = 'https://url.zendesk.com/api/v2/tickets.json'    

      const response = await fetch(url, {
        method: 'POST', // *GET, POST, PUT, DELETE, etc.
        mode: 'no-cors',
        headers: {
          'Content-Type': 'application/json',
          Authorization: api_token,

          // 'Content-Type': 'application/x-www-form-urlencoded',
        },
        body: JSON.stringify(data), // body data type must match "Content-Type" header
      })

      console.log('respone', response)
    } catch (error) {
      console.log('respone error', error)
    }
  }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It looks like you're not sending the right authorization header. According to Zendesk API reference you need to use the following format for the credentials:

{email_address}/token:{api_token}

Example:

jdoe@example.com/token:6wiIBWbGkBMo1mRDMuVwkw1EPsNkeUj95PIz2akv

After base64-encoding the resulting string, add it to the Authorization header as follows:

Authorization: Basic amRvZUBleGFtcGxlLmNvbS90b2tlbjo2d2lJQldiR2tCTW8xbVJETXVWd2t3MUVQc05rZVVqOTVQSXoyYWt2
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda