Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endpoint Management API #2249

Open
tobi-bams opened this issue Dec 19, 2024 · 2 comments
Open

Endpoint Management API #2249

tobi-bams opened this issue Dec 19, 2024 · 2 comments
Labels

Comments

@tobi-bams
Copy link
Contributor

tobi-bams commented Dec 19, 2024

Breakdown of feature flag system in: #2235

Endpoint Management API

1. POST /feature_flags/{feature_flag_id}/endpoints

  • Description:
    Adds one or more endpoints to an existing feature flag.

  • Request Body:

[
  "/api/select",
  "/api/bounty"
]
  • Response:

    • The response will include the feature flag details (feature_name, description, uuid) and the updated array of endpoints.
    • Includes success, message, and data.
  • Example Response (Success):

{
  "success": true,
  "message": "Endpoints added successfully.",
  "data": {
    "name": "FF_Select",
    "description": "Feature for selecting items",
    "uuid": "123e4567-e89b-12d3-a456-426614174000",
    "endpoints": [
      { "path": "/api/select", "uuid": "567e4567-e89b-12d3-a456-426614174110" },
      { "path": "/api/bounty", "uuid": "567e4567-e89b-12d3-a456-426614174111" }
    ]
  }
}
  • Example Response (Validation Error):
{
  "success": false,
  "message": "Invalid input. Please provide an array of endpoint paths.",
  "data": null
}

2. PUT /feature_flags/{feature_flag_id}/endpoints/{endpoint_id}

  • Description:
    Updates the path of an existing endpoint associated with a feature flag.

  • Request Body:

{
  "new_endpoint_path": "/api/new_endpoint_path"
}
  • Response:

    • The response will include the feature flag details (feature_name, description, uuid) and the updated array of endpoints.
  • Example Response (Success):

{
  "success": true,
  "message": "Endpoint updated successfully.",
  "data": {
    "name": "FF_Select",
    "description": "Feature for selecting items",
    "uuid": "123e4567-e89b-12d3-a456-426614174000",
    "endpoints": [
      { "path": "/api/new_endpoint_path", "uuid": "567e4567-e89b-12d3-a456-426614174110" },
      { "path": "/api/bounty", "uuid": "567e4567-e89b-12d3-a456-426614174111" }
    ]
  }
}
  • Example Response (Validation Error):
{
  "success": false,
  "message": "Invalid input. Please provide a valid new_endpoint_path.",
  "data": null
}
  • Example Response (Not Found):
{
  "success": false,
  "message": "Endpoint or Feature Flag not found.",
  "data": null
}

3. DELETE /feature_flags/{feature_flag_id}/endpoints/{endpoint_id}

  • Description:
    Removes an endpoint from an existing feature flag.

  • Response:

    • The response will include the feature flag details (feature_name, description, uuid) and the updated array of endpoints.
  • Example Response (Success):

{
  "success": true,
  "message": "Endpoint deleted successfully.",
}
  • Example Response (Not Found):
{
  "success": false,
  "message": "Endpoint or Feature Flag not found.",
  "data": null
}

Input Validation

  • POST /feature_flags/{feature_flag_id}/endpoints:
    • Ensure the request body is an array of strings.
    • Each string must represent a valid API path.
  • PUT /feature_flags/{feature_flag_id}/endpoints/{endpoint_id}:
    • Ensure the request body contains a valid new_endpoint_path.
    • Validate that the endpoint belongs to the specified feature flag.
  • DELETE /feature_flags/{feature_flag_id}/endpoints/{endpoint_id}:
    • Validate that the endpoint_id exists and is associated with the specified feature_flag_id.

Error Handling

  • Return appropriate success: false responses for the following cases:
    • Invalid inputs (e.g., malformed request bodies or invalid UUIDs).
    • Feature flag or endpoint not found.
    • Endpoint path already exists for the feature flag (for POST).
@aliraza556
Copy link
Contributor

@tobi-bams @humansinstitute assign me?

@MahtabBukhari
Copy link
Contributor

@tobi-bams @humansinstitute assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants