Android Question [Solved] Problem getting data via REST API

fredo

Well-Known Member
Licensed User
Longtime User

The problem was on the online service side.
Closed



The goal is to retrieve product information via REST API for an EAN number.

I have registered a test-account at an online service and received an access token.

Despite the clear instructions and available code examples in various programming languages, I consistently receive a 'The requested URL was not found on this server' server response.

B4X:
Private Sub Button1_Click
    Dim token As String = "----usertokenhere----"
    Dim ean As String = EditText1.Text
    Dim url As String =  $"https://api.ean-search.org/api?token=${token}&op=barcode-lookup&format=json&ean=${ean}"$
 
    Label1.Text = url
    Label2.Text = "..."
 
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download(url)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Label2.Text = j.GetString
    Else
        Label2.Text = j.ErrorMessage
    End If
    j.Release
End Sub

What is needed to make a successful API request?

29-04-2024_14-48-29.png

A small Testproject is attached.

Since the number of requests for my current test account is limited, I prefer not to publish the token here.
However, I can send it via private message if needed.
 

Attachments

  • RestApiTest.zip
    14.3 KB · Views: 19
Last edited:
Solution
Probably the api has changed endpoints: but docs and example are not updated.
Or the api does not exists any longer but the website to sell still works?

I suggest to contact them

There is also a email listed which you can write to.

DonManfred

Expert
Licensed User
Longtime User
Probably the api has changed endpoints: but docs and example are not updated.
Or the api does not exists any longer but the website to sell still works?

I suggest to contact them

There is also a email listed which you can write to.
 
Upvote 0
Solution
Top