Skip to main content

Apito REST API Integration with iOS


Always remember to replace API_SECRET of the Bearer Token and project-id of the URL with the correct value from apito console. Go to this page if you do not know where to find your api secrets and endpoints for your project

import Foundation

let headers = [
"content-type": "application/json",
"authorization": "Bearer API_SECRET"

let request = NSMutableURLRequest(url: NSURL(string: "")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
} else {
let httpResponse = response as? HTTPURLResponse