Trying to piece together full URL

I'm new to Android programming and I'm using MIT App Inventor. I'm trying to construct the full URL to pull JSON from, but I don't know enough to know how to construct it.
I understand that the base URL is https://od-api.oxforddictionaries.com/api/v1, but how do I compile this with my app_ID and app_key? I'm trying to simply pull definitions, nothing fancy. I want to ask my assistant "What's the definition of ____" and have her speak back the filtered results.

Tagged:

Comments

  • joughtredjoughtred Member, Administrator, Moderator admin

    Hello @ddaniel179

    There is some sample code available on our documentation page, if this helps? This might also help:

    var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://od-api.oxforddictionaries.com:443/api/v1/entries/en/ace",
    "method": "GET",
    "headers": {
    "app_id": "XXXXXXXX",
    "app_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "cache-control": "no-cache",
    "postman-token": "a1937992-4ae9-30a1-70c9-b07f5fde5db8"
    }
    }

    $.ajax(settings).done(function (response) {
    console.log(response);
    });

    Please make sure that your app key and id are placed in the headers.

    Best wishes,

    Joanne

  • AmosDuveenAmosDuveen Member, Administrator, Moderator admin

    How you specify headers very much depends on which programming language you are using. For example, the documentation page allows you to see example code in Objective-C, Swift, java, and Python. Also, there is a cURL example given when you click "try it out", although you need to change the hostname in the URL (remove the "-demo" part), the app_id, and the app_key to make it work from your own device; e.g. curl -X GET --header "Accept: application/json" --header "app_id: XXXXXXXX" --header "app_key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "https://od-api.oxforddictionaries.com:443/api/v1/entries/en/ace".

Sign In or Register to comment.