Android Question Http headers setup

Scantech

Well-Known Member
Licensed User
Longtime User
I am have Status code 405 Method not allowed.

Using API to get word definition.

Instructions from website:
Request URL
https://od-api.oxforddictionaries.com:443/api/v1/entries/en/ace
Request Headers
{
"Accept": "application/json",
"app_id": "111111111",
"app_key": "2222222222"
}

B4X:
   Sub Dictionary (jobnamekey As String, Word As String)
    Dim job As HttpJob
    Dim word_id As String = Word
    Dim jobname As String = jobnamekey
    Dim jobtag As String = ""
    Dim language As String = "en"
    Dim app_id As String = "111111111"
    Dim app_key As String = "222222222"
 
    job.Initialize(jobname, Me)
    job.Tag = jobtag

    ' Use Google Free google API translate
    Dim poststr As String = "https://od-api.oxforddictionaries.com:443/api/v1/entries/" & language & "/" & word_id
    job.PostString(poststr, "")

'    job.GetRequest.SetHeader("Content-Type", "application/json")
'    job.GetRequest.SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0")
 
    job.GetRequest.Setheader("Accept", "application/json")
    job.GetRequest.SetHeader("app_id", app_id)
    job.GetRequest.SetHeader("app_key", app_key)
    job.GetRequest.SetContentType("application/json")
    job.GetRequest.SetContentEncoding("text/plain")
 
Top