Steve

My feedback

  1. 54 votes
    Vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    5 comments  ·  Bible Search API  ·  Flag idea as inappropriate…  ·  Admin →
    Steve commented  · 

    Can we get a status update on this request? This is an important feature. There should be no formatting in the data. That should be a function of the presentation layer.

  2. 6 votes
    Vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    8 comments  ·  Bible Search API  ·  Flag idea as inappropriate…  ·  Admin →
    Steve commented  · 

    I've figured this out. My solution was based upon the @Nate Cook's answer in this Stackoverflow answer: http://stackoverflow.com/questions/24379601/how-to-make-an-http-request-basic-auth-in-swift

    The code needed to be updated a bit to Swift 3, and the code calls for a username AND a password. This Bible Search API provides only a API key. The secret for me was figuring out that the API key goes in the username variable and for the password simply use: ""

    The API uses Basic authentication which must send the API key in base64EncodedString. The stackoverflow answer shows how to do that.

    I used URLSession instead of NSURLConnection like so:
    let task = URLSession.shared.dataTask(with: request) { (data, response, error)

    I hope this helps others.

    Steve commented  · 

    I've attempted to follow that stackoverflow and a couple of other similar techniques. I keep getting back a 401 status which is an authentication error. I am able to user my token with a static URL like this: https://xYz1234nMUXmytokenhere@bibles.org/v2/search.js?query=john+3:16&version=eng-GNTD However, when the token is inserted as an authorization header as described here it doesn't work: http://swiftdeveloperblog.com/http-get-request-example-in-swift/ It would be great to get some source code from someone who has verified functionality.

    Steve commented  · 

    Thank you. I will give that a try. Much appreciated.

    Steve shared this idea  · 

Feedback and Knowledge Base