WingifyGuides

Create a Feature Flag

#Request URI for Sub Account

POST /accounts/123456/features

#Sample Request Body

{
    "name": "FeatureFlag1",
    "featureKey": "featureflag1",
    "description": "First feature flag created via REST APIs",
    "featureType": "TEMPORARY",
    "goals": [
        {
            "metricId": 5
        }
    ],
    "variables": [
        {
            "variableName": "variable1",
            "dataType": "string",
            "defaultValue": "Hello World"
        },
        {
            "variableName": "variable2",
            "dataType": "integer",
            "defaultValue": 10
        },
        {
            "variableName": "variable3",
            "dataType": "json",
            "defaultValue": { "name": "Wingify", "description": "Description" }
        }
    ]
}

#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": {
      "post": {
        "summary": "Create a Feature Flag",
        "description": "",
        "operationId": "fme-create-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
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "featureKey",
                  "featureType"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Feature Flag Name"
                  },
                  "featureKey": {
                    "type": "string",
                    "description": "Unique Feature identifier"
                  },
                  "description": {
                    "type": "string",
                    "description": "Feature Flag Description"
                  },
                  "featureType": {
                    "type": "string",
                    "description": "Type of Feature Flag i.e. Temporary or Permanent",
                    "default": "TEMPORARY",
                    "enum": [
                      "TEMPORARY",
                      "PERMANENT"
                    ]
                  },
                  "goals": {
                    "type": "object",
                    "description": "Feature Flag Metric - At least one is required. Check sample request body.",
                    "required": [
                      "metricId"
                    ],
                    "properties": {
                      "metricId": {
                        "type": "integer",
                        "description": "Metric ID to be used in Feature Flag",
                        "format": "int32"
                      }
                    }
                  },
                  "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"
                    }
                  }
                }
              }
            }
          }
        },
        "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
}