Hi, I want to use growthbook api withing api secre...
# announcements
d
Hi, I want to use growthbook api withing api secret to update/get a feature, in both ways of authentication I'm getting JWT Token malformed error here is the sample request that I'm sending using
Bearer
Copy code
$ curl <https://growthbook-api.example.com/feature/sample_feature_name> -H "Authorization: Bearer secret_xxxxxxxxxxxxxxxxxxxxxxxxx"
{
  "status": 401,
  "message": "jwt malformed"
}
using basicAuth
Copy code
$ curl <https://growthbook-api.example.com/feature/sample_feature_name> -u secret_xxxxxxxxxxxxxxxxxxxxxxxxx:
{
  "status": 401,
  "message": "Format is Authorization: Bearer [token]"
}
any ideas?
@fresh-football-47124 Can you help me?
f
Hi Hosein
I’m not too familiar with that error
but I can have someone from the team look at it when they’re up
b
it looks like you may be trying to hit the private API that the product itself uses. the exposed public API is at the namespace
/api/v1
assuming you're trying to use this endpoint: https://docs.growthbook.io/api/#tag/features/operation/getFeature
so instead of:
Copy code
<https://growthbook-api.example.com/feature/sample_feature_name>
use:
Copy code
<https://growthbook-api.example.com/api/v1/features/sample_feature_name>
note that
feature
needs to be
features
.
d
Thank you.
s
Hey I'm trying to find info on the recommended approach for using GrowthBook Feature Flags in CI/CD. The problem we're trying to solve specifically is we want to release new features behind a flag in our Java backend, and then test them in QA one at a time. I see there are some options in the Java SDK docs like
isQaMode
and
forcedVariationsMap
, but I don't understand how our QA team would toggle those on a per test basis. Perhaps we'd be better off using the feature toggle endpoint as described above? Thanks!
b
@steep-dawn-35762 you may also find the ability to force features via the URL useful. it supports primitive as well as serializable JSON feature values. here's some docs on that: https://docs.growthbook.io/lib/java#force-feature-values-via-the-url it would require you to pass the current page URL to the SDK. you can see an example of that here: https://github.com/growthbook/examples/blob/main/jvm-spring-web/src/main/java/com/example/demo/MainController.java#L314-L355 constructing the URL is not as fun. we had begun looking into support in the chrome devtools but stopped for various reasons. for now, you can pop open a browser console and run
encodeURIComponent
.. or encode URLs another way. what you could do is in your staging or QA environment, set
.allowUrlOverrides(true)
but use
.allowUrlOverrides(false)
in production (unless you're comfortable with tech savvy users enabling features for themselves).