Implementing the Request URL into a imported cocapod that uses WordNik API 2 posts by 1 author

20 views
Skip to first unread message

swift dev

unread,
Feb 24, 2018, 6:07:48 AM2/24/18
to Wordnik API

Hi guys


Im making a swift app in Xcode that makes use of a cocapod call HNKWordLookup. This pod uses the WordNik API to return a random word. My only issue is that a lot of the words that are returned are quite obscure. After looking through this google group I gathered that I need to use the minCorpusCount and the minDictionaryCount to refine my words that are pulled by the API. 

I figured out how to do this on the http://developer.wordnik.com/docs page, and have been given a Request URL. I assume I need to put this into my code somewhere in place of another URL that is present within the pre written pod, but I have no clue where to put the request URL. At first I put it in place in the following line of code:

static NSString *const kHNKLookupBaseUrl = @"http://api.wordnik.com:80/v4";


changing it to


static NSString *const kHNKLookupBaseUrl = @"http://api.wordnik.com:80/v4/words.json/randomWord?hasDictionaryDef=true&excludePartOfSpeech=definite-article&minCorpusCount=1&maxCorpusCount=-1&minDictionaryCount=30&maxDictionaryCount=-1&minLength=1&maxLength=-1&api_key=[my api key]

";


but this broke my code. Is there a certain phrase or area that I should be looking out for where I can put my new request URL in and thus run my program with my desired parameters?

 just worth noting that I get the following error:  " Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: unauthorized (401)" UserInfo={NSLocalizedDescription=Request failed: unauthorized (401)" 

Erin McKean

unread,
Feb 24, 2018, 12:04:40 PM2/24/18
to Wordnik API
Hi! I looks as if you found your answer on StackOverflow, I'm adding that link here to help others who might find this post and have the same issue: 


Thanks!

Erin
Reply all
Reply to author
Forward
0 new messages