Comments (6)
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.
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.
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.
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.
This Problem still persists and had to use mock server(which returns only 1 user data).
from spring-rest-client-examples.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-rest-client-examples.