title: Convert CURL to URLRequest
body: <p>I’m trying to converting the the following curl request Swagger gives me to URLRequest:</p>
  
  <pre><code>curl -X GET --header 'Accept: application/json' 
  --header 'Authorization: key ttn-account-v2.&lt;app-key&gt;'
   'https://&lt;app-id&gt;.data.thethingsnetwork.org/api/v2/query'
  </code></pre>
  
  <p>URL and Headers are set correctly. Still I get the response: 401 - Not authorized.</p>
  
  <pre><code>let key = "ttn-account-v2.&lt;app-key&gt;"
  
  let url = URL(string: "https://&lt;app-id&gt;.data.thethingsnetwork.org/api/v2/query")
  
  var request = URLRequest(url: url!)
  
  request.httpMethod = "GET"
  request.addValue("application/json", forHTTPHeaderField: "Accept")
  request.addValue("key \(key)", forHTTPHeaderField: "Authorization")
  
  let task = URLSession.shared.dataTask(with: url!) { data, response, error in
      guard error == nil else {
          print(error!)
          return
      }
      guard let data = data else {
          print("Data is empty")
          return
      }
  
      let json = try! JSONSerialization.jsonObject(with: data, options: [])
      print(json)
  }
  task.resume()
  </code></pre>
  
  <p>Am I missing something?</p>