'expected declaration' error trying to use Swift Entry API code.

I'm trying to get the OED API to work in my xCode/Swift file. And am running into an error in two places. After the URL request

request.addValue("application/json", forHTTPHeaderField: "Accept")
_ = session.dataTask(with: request, completionHandler: { data, response, error in

These two lines throws the error 'expected declaration'

I got the code I'm working with here https://developer.oxforddictionaries.com/documentation#/Entries

I'm not sure I can even use the OED API, because I've read you can't use this API client side and I'd have to make a sever. But I don't exactly understand what that means. Does that mean I can't use the API to use with my iOS app?

Comments

  • TaisFukushimaTaisFukushima Member, Administrator, Moderator admin

    Hello @jnorstrom255

    I've forwarded your question to my colleagues in the technical team so hopefully myself or one of them should be able to get back to you - bear with us!

    Also, just to clarify the English data available through the API is from our dictionary of current English not the OED.

  • TaisFukushimaTaisFukushima Member, Administrator, Moderator admin

    Hello @jnorstrom255

    We suspect that the code has some errors so we have created a ticket for the developers that work at the website to investigate it.

    The Oxford Dictionaries API is available for everyone, and the access will depend on the plan. For example, if you are in a Prototype plan you have a limited access, which you will only be able to use Entries and Lemmas endpoints. But with Developer plan you will have full access.

    I hope it helped!

Sign In or Register to comment.