Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apifaketory dropped support for getting users list #6

Open
igavrysh opened this issue Sep 4, 2019 · 6 comments
Open

apifaketory dropped support for getting users list #6

igavrysh opened this issue Sep 4, 2019 · 6 comments

Comments

@igavrysh
Copy link

igavrysh commented Sep 4, 2019

http://apifaketory.com/api/user?limit=10 is no longer available.

I am using http://private-anon-ce456ed119-apifaketory.apiary-mock.com/api/user?limit=1
as an interim solution. However, it returns only 1 user regardless of limit param

@rjdarksky1
Copy link

rjdarksky1 commented Sep 19, 2019

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

@bedwar2
Copy link

bedwar2 commented Feb 23, 2020

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.

@nilneonilesh
Copy link

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

@Mesqualito
Copy link

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?!

Mesqualito added a commit to Mesqualito/spring-apitest that referenced this issue Oct 6, 2020
@raphaeltesttest
Copy link

raphaeltesttest commented Feb 17, 2021

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!!!

@prashant3jan
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants