Build Feature Flag Endpoints
Breakdown of feature flag system in: https://github.com/stakwork/sphinx-tribes/issues/2235
1. GET /feature_flags
-
Description:
This endpoint retrieves a list of all feature flags, including their status (enabled) and associated endpoints. -
Response:
- The response will return a structured object with the following fields:
success: A boolean indicating whether the operation was successful.message: A descriptive message (e.g., "Feature flags fetched successfully").data: An array of feature flag objects containing the details of each feature flag
- The response will return a structured object with the following fields:
-
Example Response:
{
"success": true,
"message": "Feature flags fetched successfully.",
"data": [
{
"name": "FF_Chat",
"description": "Enables chat feature",
"enabled": true,
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"endpoints": [
{ "path": "/api/v1/chat", "uuid": "567e4567-e89b-12d3-a456-426614174111" },
{ "path": "/api/v1/chat/:id", "uuid": "567e4567-e89b-12d3-a456-426614174112" }
]
},
{
"name": "FF_Payments",
"description": "Enables payments feature",
"enabled": false,
"uuid": "123e4567-e89b-12d3-a456-426614174001",
"endpoints": [
{ "path": "/api/v1/payment", "uuid": "567e4567-e89b-12d3-a456-426614174113" }
]
}
]
}
2. POST /feature_flags
-
Description:
This endpoint allows admins to create a new feature flag with associated endpoints. -
Request Body:
{
"name": "FF_Chat",
"description": "Enables chat feature",
"enabled": false,
"endpoints": ["/api/v1/chat", "/api/v1/chat/:id"]
}
-
Response:
- The response will return the newly created feature flag object, along with a
successstatus, a message, and the created data.
- The response will return the newly created feature flag object, along with a
-
Example Response:
{
"success": true,
"message": "Feature flag created successfully.",
"data": {
"name": "FF_Chat",
"description": "Enables chat feature",
"enabled": false,
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"endpoints": [
{ "path": "/api/v1/chat", "uuid": "567e4567-e89b-12d3-a456-426614174111" },
{ "path": "/api/v1/chat/:id", "uuid": "567e4567-e89b-12d3-a456-426614174112" }
]
}
}
3. PUT /feature_flags/{id}
-
Description:
This endpoint allows admins to update an existing feature flag’s name, description, and enabled status. -
Request Body:
{
"name": "FF_Chat",
"description": "Enables chat feature with enhancements",
"enabled": true
}
-
Response:
- The response will return the updated feature flag object, along with a
successstatus, a message, and the updated data.
- The response will return the updated feature flag object, along with a
-
Example Response:
{
"success": true,
"message": "Feature flag updated successfully.",
"data": {
"name": "FF_Chat",
"description": "Enables chat feature with enhancements",
"enabled": true,
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"endpoints": [
{ "path": "/api/v1/chat", "uuid": "567e4567-e89b-12d3-a456-426614174111" },
{ "path": "/api/v1/chat/:id", "uuid": "567e4567-e89b-12d3-a456-426614174112" }
]
}
}
4. DELETE /feature_flags/{id}
-
Description:
This endpoint allows admins to delete an existing feature flag along with its associated endpoints. -
Response:
- The response will return a
successstatus, a message indicating whether the deletion was successful, and an appropriate error message if the feature flag was not found.
- The response will return a
-
Example Response (Success):
{
"success": true,
"message": "Feature flag successfully deleted.",
"data": null
}
- Example Response (Not Found):
{
"success": false,
"message": "Feature flag not found.",
"data": null
}
@humansinstitute @tobi-bams assign me?
@tobi-bams @humansinstitute Please assign me?
@tobi-bams @humansinstitute assign