Giter VIP home page Giter VIP logo

Comments (6)

raphaeltesttest avatar raphaeltesttest commented on August 31, 2024 10

Problem solved! Use https://jsonplaceholder.typicode.com/users as an alternative API.

//Note that the jasonplaceholder returns a List of User and not a UserData as expected from apifaketory.
//Note that limit is now with underscore, _limit

@OverRide
public List getUsers(Integer limit) {

 List<User> userData = restTemplate.getForObject("https://jsonplaceholder.typicode.com/users?_limit=" + limit, List.class);

 return userData;

}

As you can see, the jsonplaceholder does not return the same payload as apifaketory:

[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "[email protected]",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
},
...
]

So you have to refactor the domain model to Address, Company, Geo, etc.,

My repo if you need it!
https://github.com/raphaeltesttest/spring-rest-client-examples

Good luck!!!

from spring-rest-client-examples.

bedwar2 avatar bedwar2 commented on August 31, 2024 2

Also having the same issue. Course needs updating to something different or SpringGuru.com should considering providing the api to reduce this type of risk.

from spring-rest-client-examples.

Mesqualito avatar Mesqualito commented on August 31, 2024 1

It seems you have to write an example API on your own now. Regarding the comment in https://stackoverflow.com/a/31527616/7773582: Apiary has no concept of the array inside the response. You have to prepare the filtered arrays yourself as different responses, one response with limit parameter and corresponding JSON-array has to be set up for EVERY number which seems very strange to me?!

from spring-rest-client-examples.

rjdarksky1 avatar rjdarksky1 commented on August 31, 2024

same issue, only mock server provides service which returns only one obj regardless of limit, while the other two servers all returned 502

from spring-rest-client-examples.

nilneonilesh avatar nilneonilesh commented on August 31, 2024

This Problem still persists and had to use mock server(which returns only 1 user data).

from spring-rest-client-examples.

prashant3jan avatar prashant3jan commented on August 31, 2024

you can fake an api on your desktop by following the link below:
https://www.youtube.com/watch?v=7vx0RIwHVzg
If you are following springguru.com you can put the data from apifaketory in db.json file that will be created if you follow the above link

from spring-rest-client-examples.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.