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

206
Views
How to toggle unleash feature flag through api for a specific environments

In my project, I have three environments and I want to toggle a feature flag only on for a specific environment Is it possible to toggle unleash feature flag with API for a development environment only? I am using the below code to toggle the flag but it works for default mode only

function enabledToggle() { axios .get("http://unleash.host.com/api/admin/features/:featureName/toggle/on", { headers: { Authorization: ${"my-token"}, } }) .then(function (response) { console.log(response.data); }) .catch(function (error) { console.log(error); }); }

I also tried one more way but I got this error I am trying to turn on the feature flag through this API but I am getting an error when I execute the above function I am getting this error Request failed with status code 415 can anyone help what I am doing wrong? here is my code

function oNFeatureFlag(){

axios({url:"https://host.name/api/admin/projects/default/features/feature-name/environments/development/on", headers: {Authorization: ${"my token"},}, method: "post", }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); });}

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try setting content-type to application/json explicitly.

This is most likely because of the way Axios sets the content-type header. From what I understand, it sets content-type to application/json;charset=utf-8. Prior to a recent version of Unleash, Unleash didn't parse this properly, so it would give you a 415 Unsupported Media Type response.

For reference, here's the same question as a GitHub issue.

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!