import Foundation
let jsonData = [
"userId": "foo",
"email": "foo@gmail.com"
] as [String : Any]
let data = try! JSONSerialization.data(withJSONObject: jsonData, options: [])
let url = URL(string: "https://api.tggl.io/flags")!
let headers = [
"Content-Type": "application/json",
"x-tggl-api-key": "API_KEY"
]
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = data as Data
let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
if let error = error {
print(error)
} else if let data = data {
let str = String(data: data, encoding: .utf8)
print(str ?? "")
}
}
task.resume()
Empower product and marketing teams to experiment within safe boundaries set by your engineering team.
Your app is instantly updated when a flag is updated, no need to write code and deploy the new version.