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

81
Views
Implementing Twilio Api call from a CURL example to js returns status code of 200 but does not seem to update data

I am trying to update my sim fleet name and sim unique name without any success

  const url = `https://supersim.twilio.com/v1/Sims/${sid}? fleet=${fleet}&uniqueName=${uniqueName}`;


  const resp = await fetch(url, {
    method: "POST",
    headers: new Headers({
      Authorization: auth.twilioAuth,
      "Content-Type": "application/x-www-form-urlencoded",
    }),
    body: new URLSearchParams({
      Iccid: iccid,
    }).toString(),
  });

I get a 200 response with my sim object as follows

account_sid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
date_created: "2022-01-08T21:05:00Z"
date_updated: "2022-01-08T21:05:00Z"
fleet_sid: null  //did not update
iccid: "XXXXXXXXXXXXX"
links: {billing_periods: 'https://supersim.twilio.com/v1/Sims/HSXXXXXXXXXXXXXXXXXXXXXXXX/BillingPeriods'}
sid: "HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
status: "new"
unique_name: null  //did not update
url: "https://supersim.twilio.com/v1/Sims/HSXXXXXXXXXXXXXXXXXXXXXXXXXXX"


Twilio documentation

and this is what their CURL example website says

curl -X POST https://wireless.twilio.com/v1/Sims/DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
--data-urlencode "CallbackMethod=POST" \
--data-urlencode "CallbackUrl=https://sim-manager.mycompany.com/sim-update-callback/AliceSmithSmartMeter" \
--data-urlencode "Status=active" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should send the parameters you want to update in the body of the request, not in the query parameters. Also note that the parameter names are in Pascal case. Try this:

  const url = `https://supersim.twilio.com/v1/Sims/${sid}`;

  const resp = await fetch(url, {
    method: "POST",
    headers: new Headers({
      Authorization: auth.twilioAuth,
      "Content-Type": "application/x-www-form-urlencoded",
    }),
    body: new URLSearchParams({
      Iccid: iccid,
      Fleet: fleet,
      UniqueName: uniqueName
    }).toString(),
  });
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!