FindById Return Not Found
fajrulakram opened this issue · 4 comments
Hi, I'm beginner in this but I've followed every tutorial there is regarding loopback android sdk. I'm using loopback android sdk ver. 1.5.2 and I've successfully make the login procedure, but I notice that the login doesn't return the user rather it only returns the token. When I confirm it in the explorer it returns the following data :
{
"id": "nv51KFeWJGjW8O4Q8XrLBkQjWRCrVuMfrvRCpI8N9gEgoPfCMR3FGX3NEcdX3nBy",
"ttl": 1209600,
"created": "2015-06-17T13:03:18.917Z",
"userId": 2
}
so, since I don't get the user data but the user id, I try to get the user data using findById method in user repository, but it returns "HTTP request (string) failed: org.apache.http.client.HttpResponseException: Not Found".
Can anybody explain to me where did I go wrong in this ?
Same thing here.
Anyone can help?
You can add ?include=user
to the login URL to get the user data returned too. AFAICT, the SDK is already doing that - see https://github.com/strongloop/loopback-sdk-android/blob/e2214e7e474c07b115ae4546331e190f1aca3beb/src/main/java/com/strongloop/android/loopback/UserRepository.java#L191-L192.
so, since I don't get the user data but the user id, I try to get the user data using findById method in user repository
Could you please share a code snippet?
Also is your AccessToken
model correctly configured with a belongsTo User
relation on the server?
Closing due to inactivity