WingifyGuides

Update a Feature Flag

#Request URI for Sub Account

PATCH /accounts/123456/features/1

#Sample Request Body

{
    "name": "Feature Flag Name",
    "description": "Feature Flag Description",
    "goals": [
        {
            "metricId": 123456
        }
    ],
    "variables": [
        {
            "variableName": "variable1",
            "dataType": "string",
            "defaultValue": "Hello World"
        },
        {
            "variableName": "variable2",
            "dataType": "integer",
            "defaultValue": 10
        },
        {
            "variableName": "variable3",
            "dataType": "json",
            "defaultValue": {
                "name": "Wingify",
                "product": "FE"
            }
        }
    ],
    "variations": [
        {
            "name": "variation-name",
            "key": "variation-key",
            "variables": [
                {
                    "variableId": 1,
                    "value": "Hello World updated"
                },
                {
                    "variableId": 2,
                    "value": 20
                }
            ]
        }
    ]
}

#OpenAPI definition

{
  "openapi": "3.1.0",
  "info": {
    "title": "fme-apis",
    "version": "4"
  },
  "servers": [
    {
      "url": "https://app.wingify.com/api/v2"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "token"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/accounts/{account_id}/features/{feature_id_or_key}": {
      "patch": {
        "summary": "Update a Feature Flag",
        "description": "",
        "operationId": "fme-update-a-feature-flag",
        "parameters": [
          {
            "name": "account_id",
            "in": "path",
            "description": "Use 'current' keyword to refer to the Main Workspace or the Integer Workspace Id",
            "schema": {
              "type": "string",
              "default": "current"
            },
            "required": true
          },
          {
            "name": "feature_id_or_key",
            "in": "path",
            "description": "Feature Flag ID/Key",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Feature Flag Name"
                  },
                  "description": {
                    "type": "string",
                    "description": "Feature Flag Description"
                  },
                  "goals": {
                    "type": "array",
                    "description": "Feature Flag Metric - At least one is required. Check sample request body.",
                    "items": {
                      "properties": {
                        "metricId": {
                          "type": "integer",
                          "description": "Metric ID to be used in Feature Flag",
                          "format": "int32"
                        }
                      },
                      "required": [
                        "metricId"
                      ],
                      "type": "object"
                    }
                  },
                  "variables": {
                    "type": "array",
                    "description": "Feature Flag Variables. Check sample request body.",
                    "items": {
                      "properties": {
                        "variableName": {
                          "type": "string",
                          "description": "Variable Name"
                        },
                        "dataType": {
                          "type": "string",
                          "description": "Variable Type",
                          "default": "string",
                          "enum": [
                            "string",
                            "int",
                            "float",
                            "json"
                          ]
                        },
                        "defaultValue": {
                          "type": "string",
                          "description": "Depending upon variable data-type, pass the variable's value"
                        }
                      },
                      "required": [
                        "variableName",
                        "dataType",
                        "defaultValue"
                      ],
                      "type": "object"
                    }
                  },
                  "variations": {
                    "type": "array",
                    "description": "Feature Flag Variations",
                    "items": {
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Variation Name"
                        },
                        "key": {
                          "type": "string",
                          "description": "Unique Variation Identifier"
                        },
                        "variables": {
                          "type": "array",
                          "items": {
                            "properties": {
                              "variableId": {
                                "type": "integer",
                                "description": "Variable ID",
                                "format": "int32"
                              },
                              "value": {
                                "type": "string",
                                "description": "Variable Value"
                              }
                            },
                            "required": [
                              "variableId",
                              "value"
                            ],
                            "type": "object"
                          }
                        }
                      },
                      "required": [
                        "name",
                        "key"
                      ],
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"_errors\": [\n    {\n      \"code\": 400,\n      \"message\": \"Descriptive error message indicating the issue.\"\n    }\n  ]\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "_errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "integer",
                            "example": 400,
                            "default": 0
                          },
                          "message": {
                            "type": "string",
                            "example": "Descriptive error message indicating the issue."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}