Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

357
Vistas
Curl Request to Axios Request how?
curl -H "Authorization: Token token=sfg999666t673t7t82" -H "Content-Type: application/json" -d '{"phone_call": { "call_direction": true, "targetable_type": "contact", "targetable": { "id": "1", "first_name": "Jane", "last_name": "Sampleton (sample)", "work_number ":"5304915427", "mobile_number ":"11919457004 " }, "note ": { "description": "Sample note"} }}' -X POST https://domain.myfreshworks.com/crm/sales/api/phone_calls

When ı do this request ı succesfully get the response, but ı just want to same request with axios. How can I do that ? I try this but not works ı get'a cors error.


 const headers = {
      'Content-Type': 'application/json',
      Authorization: 'Token sfg999666t673t7t82',
    };
    var dataString =
      '{"phone_call": { "call_direction": true, "targetable_type": "contact", "targetable": { "id": "1", "first_name": "Jane", "last_name": "Sampleton (sample)", "work_number ":"5304915427", "mobile_number ":"11919457004 " }, "note ": { "description": "Sample note"} }}';

    Axios.post('https://domain.myfreshworks.com/crm/sales/api/phone_calls', dataString, {
      headers: headers,
    })
      .then((response) => {
        console.log(response);
      })
      .catch((error) => {
        console.log(error);
      });

``
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The headers seem incorrect in your axios version.

Authorization: Token token=sfg999666t673t7t82 is not the same as Authorization: 'Token sfg999666t673t7t82'.

Try changing Authorization: 'Token sfg999666t673t7t82' to Authorization: 'Token token=sfg999666t673t7t82' so that the requests are equivalent.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda