Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

356
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!