1
votes

I've setup a basic java json api for testing. I can access it through a web browser, or with Rest.get("https://guarded-thicket-52527.herokuapp.com/users").jsonContent(). However when I try the following code:

RESTfulWebServiceClient client = new RESTfulWebServiceClient("https://fatidique-croissant-89302.herokuapp.com/users");   
client.find(
    new Query(), rowset -> {  
});

It gives me a 404 error. I haven't started trying to deal with the data, since I get the 404 before I can get to it.

1
I suggest opening the network monitor tool in the simulator. You can use that to see the requests going out and then understand why this request returns a 404. I'm not an expert on this specific API but it looks to me like it fails because the query is blank. - Shai Almog
Thanks Shai! The network monitor shows going to the url fatidique-croissant-89302.herokuapp.com/users/0/29. According to this page codenameone.com/blog/connecting-to-a-mysql-database-part-2.html the query automatically grabs the first 30 items. which is why it's automatically appending the 0/29 which my api doesn't handle. I've fixed it by adding doing new Query().id("") instead of just new Query() to go directly to the address provided. - Rochana Sawatzky

1 Answers

1
votes

The network monitor shows going to the url fatidique-croissant-89302.herokuapp.com/users/0/29. I've fixed it by adding doing new Query().id("") instead of just new Query() to go directly to the address provided.