     }
   }
 
+  private func apiRequest(_ route: String, method: HTTPMethod? = nil, body: Data? = nil) -> JSONResponse {
+    return apiRequest(URL(string: "https://api.spotify.com/v1/\(route)")!, method: method, body: body)
+  }
+
   private func apiRequest(_ route: String, method: HTTPMethod? = nil, body: String? = nil) -> JSONResponse {
     return apiRequest(route, method: method, body: body?.data(using: .utf8))
   }

    return encoded!.base64EncodedString()
  }

  static func synchronousRequest(_ urlString: String, headers: [String: String]? = nil, method: HTTPMethod? = nil, body: String? = nil) -> JSONResponse {
    return Utils.synchronousRequest(urlString, headers: headers, method: method, body: body?.data(using: .utf8))
  }

  static func synchronousRequest(_ urlString: String, headers maybeHeaders: [String: String]? = nil, method maybeMethod: HTTPMethod? = nil, body: Data? = nil) -> JSONResponse {
    let method = maybeMethod ?? .GET
    let headers = maybeHeaders ?? [:]

    let url = URL(string: urlString)!
    var data: Data?
    var response: HTTPURLResponse!
    var error: Error?

    return apiRequest(route, method: method, body: thisVarHelpsAvoidAmbiguity)
  }

  private func apiRequestWithAllPages(_ route: String) -> [JSONResponse] {
    var requests = [JSONResponse]()

    let firstRequest = apiRequest(route)
    requests.append(firstRequest)
    var nextUrl = firstRequest.json["next"] as? String

    while let str = nextUrl, let url = URL(string: str) {
      let request = apiRequest(url)

      requests.append(request)

      nextUrl = request.json["next"] as? String
    }

    return requests
  }

  private func refreshToken() -> String {
    let auth = Utils.b64("\(credentials.clientId):\(credentials.clientSecret)")
    let (json, response, _) = Utils.synchronousRequest(
      URL(string: "https://accounts.spotify.com/api/token")!,
      headers: ["Authorization": "Basic \(auth)"],
      method: .POST,
      body: "grant_type=refresh_token&refresh_token=\(credentials.refreshToken)"
