title: Convert cUrl command to HTTP Request in Swift
body: <p>I am building an app that checks domain availability. Right now, I am using the goDaddy API; according to goDaddy, the way to check URL availability is by the following cURL command:</p>
  
  <pre><code>curl -X GET -H "Authorization: sso-key {API_KEY}:{API_SECRET}" "https://api.godaddy.com/v1/domains/available?domain=example.guru"
  </code></pre>
  
  <p>Right now, I am trying to translate that cURL command to Swift. I am using Alamofire; however, when I make a request, an error as the following shows up:</p>
  
  <blockquote>
    <p>Credentials must be specified</p>
  </blockquote>
  
  <p>I was wondering how to solve this problem. Here is my current code:</p>
  
  <pre><code>class ViewController: UIViewController {
  
      let key = "KEYKEYKEY"
      let secret = "SECRETSECRET"
  
      var headers: HTTPHeaders = [:]
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          let credential = URLCredential(user: key, password: secret, persistence: .forSession)
  
          Alamofire.request("https://api.godaddy.com/v1/domains/available?domain=example.guru")
              .authenticate(usingCredential: credential)
              .responseJSON { response in
                  debugPrint(response)
          }
  
          // Do any additional setup after loading the view, typically from a nib.
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  }
  </code></pre>