angular-spring-data-rest icon indicating copy to clipboard operation
angular-spring-data-rest copied to clipboard

Not able to fetch underlying link data

Open kkolli1127 opened this issue 7 years ago • 6 comments

Hi Guy,

I'm writing to you as a last resort to help solve my current issue. I have used your code earlier to fetch the underlying links data and it worked fine. Currently when I'm trying to use it, it is not working. Not sure why.

Below is my code: I have included all the required dependencies and compared the code with your example. Everything seems fine.

JSON:

{ "amount": 0, "year": 2017, "month": 3, "assessmentDate": "2017-03-07T18:30:00.000+0000", "transactionBalance": null, "_links": { "self": { "href": "http://localhost:8080/totalcharges/1046" }, "currentCharges": { "href": "http://localhost:8080/totalcharges/1046" }, "homeId": { "href": "http://localhost:8080/totalcharges/1046/homeId" }, "communityInfo": { "href": "http://localhost:8080/totalcharges/1046/communityInfo" }, "hoaId": { "href": "http://localhost:8080/totalcharges/1046/hoaId" }, "assessmentRuleType": { "href": "http://localhost:8080/totalcharges/1046/assessmentRuleType" } } }

JS Code:

SpringDataRestAdapter.process($http.get('/totalcharges/search/findByHoaId_hoaId?hoaId=1289','homeId',true)).then(function (processedResponse) { console.log("Inside adapter all"); $scope.totalCharges = processedResponse._embeddedItems; console.log('attendance users '+ JSON.stringify($scope.totalCharges)); });

Can you help me with some troubleshooting steps?

Thanks, Kiran

kkolli1127 avatar Apr 17 '17 04:04 kkolli1127

I think you placed your closing parenthesis to arguments to late. You have

SpringDataRestAdapter.process($http.get('/totalcharges/ search/findByHoaId_hoaId?hoaId=1289','homeId',true))

Try SpringDataRestAdapter.process($http.get('/totalcharges/ search/findByHoaId_hoaId?hoaId=1289'),'homeId',true)

The get request needs to turn the penis to the first argument, followed by the child selector/selectors and the recursive flag.

On Apr 16, 2017 9:30 PM, "kkolli1127" [email protected] wrote:

Hi Guy,

I'm writing to you as a last resort to help solve my current issue. I have used your code earlier to fetch the underlying links data and it worked fine. Currently when I'm trying to use it, it is not working. Not sure why.

Below is my code: I have included all the required dependencies and compared the code with your example. Everything seems fine.

JSON:

{ "amount": 0, "year": 2017, "month": 3, "assessmentDate": "2017-03-07T18:30:00.000+0000", "transactionBalance": null, "_links": { "self": { "href": "http://localhost:8080/totalcharges/1046" }, "currentCharges": { "href": "http://localhost:8080/totalcharges/1046" }, "homeId": { "href": "http://localhost:8080/totalcharges/1046/homeId" }, "communityInfo": { "href": "http://localhost:8080/totalcharges/1046/ communityInfo" }, "hoaId": { "href": "http://localhost:8080/ totalcharges/1046/hoaId" }, "assessmentRuleType": { "href": " http://localhost:8080/totalcharges/1046/assessmentRuleType" } } }

JS Code:

SpringDataRestAdapter.process($http.get('/totalcharges/ search/findByHoaId_hoaId?hoaId=1289','homeId',true)).then(function (processedResponse) { console.log("Inside adapter all"); $scope.totalCharges = processedResponse._embeddedItems; console.log('attendance users '+ JSON.stringify($scope.totalCharges)); });

Can you help me with some troubleshooting steps?

Thanks, Kiran

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/guylabs/angular-spring-data-rest/issues/35, or mute the thread https://github.com/notifications/unsubscribe-auth/AGiCi3HPPJgVeDN4P6J2EIlaGTRiGgx4ks5rwurUgaJpZM4M-3Ia .

mattvalli avatar Apr 17 '17 15:04 mattvalli

Sorry about the inappropriate word...I posted from my phone and auto correct replaced it. 😐

On Apr 17, 2017 8:22 AM, "Matthew Valli" [email protected] wrote:

I think you placed your closing parenthesis to arguments to late. You have

SpringDataRestAdapter.process($http.get('/totalcharges/searc h/findByHoaId_hoaId?hoaId=1289','homeId',true))

Try SpringDataRestAdapter.process($http.get('/totalcharges/searc h/findByHoaId_hoaId?hoaId=1289'),'homeId',true)

The get request needs to turn the penis to the first argument, followed by the child selector/selectors and the recursive flag.

On Apr 16, 2017 9:30 PM, "kkolli1127" [email protected] wrote:

Hi Guy,

I'm writing to you as a last resort to help solve my current issue. I have used your code earlier to fetch the underlying links data and it worked fine. Currently when I'm trying to use it, it is not working. Not sure why.

Below is my code: I have included all the required dependencies and compared the code with your example. Everything seems fine.

JSON:

{ "amount": 0, "year": 2017, "month": 3, "assessmentDate": "2017-03-07T18:30:00.000+0000", "transactionBalance": null, "_links": { "self": { "href": "http://localhost:8080/totalcharges/1046" }, "currentCharges": { "href": "http://localhost:8080/totalcharges/1046" }, "homeId": { "href": "http://localhost:8080/totalcharges/1046/homeId" }, "communityInfo": { "href": "http://localhost:8080/totalch arges/1046/communityInfo" }, "hoaId": { "href": " http://localhost:8080/totalcharges/1046/hoaId" }, "assessmentRuleType": { "href": "http://localhost:8080/totalcharges/1046/assessmentRuleType" } } }

JS Code:

SpringDataRestAdapter.process($http.get('/totalcharges/searc h/findByHoaId_hoaId?hoaId=1289','homeId',true)).then(function (processedResponse) { console.log("Inside adapter all"); $scope.totalCharges = processedResponse._embeddedItems; console.log('attendance users '+ JSON.stringify($scope.totalCharges)); });

Can you help me with some troubleshooting steps?

Thanks, Kiran

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/guylabs/angular-spring-data-rest/issues/35, or mute the thread https://github.com/notifications/unsubscribe-auth/AGiCi3HPPJgVeDN4P6J2EIlaGTRiGgx4ks5rwurUgaJpZM4M-3Ia .

mattvalli avatar Apr 17 '17 15:04 mattvalli

Hey Matt,

Thanks for pointing it out. I corrected it now. I see that it is trying to fetch the data from the underlying link (in the Network tab), but it is failing with the below error.

Possibly unhandled rejection: {"data":null,"status":-1,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"http://localhost:8080/totalcharges/749/communityInfo","headers":{"Accept":"application/json, text/plain, */*"}},"statusText":""}

kkolli1127 avatar Apr 18 '17 04:04 kkolli1127

You may have already solved the problem, but with my experience that error occurs when the API server has either not configured a GET Request for the provided route or the API had some form of security feature disabling the request.

For example, the team I work with uses Spring Boot, where both scenarios have appeared.

On Apr 17, 2017 9:25 PM, "kkolli1127" [email protected] wrote:

Hey Matt,

Thanks for pointing it out. I corrected it now. I see that it is trying to fetch the data from the underlying link (in the Network tab), but it is failing with the below error.

Possibly unhandled rejection: {"data":null,"status":-1," config":{"method":"GET","transformRequest":[null]," transformResponse":[null],"jsonpCallbackParam":"callback","url":" http://localhost:8080/totalcharges/749/communityInfo ","headers":{"Accept":"application/json, text/plain, /"}},"statusText":""}

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/guylabs/angular-spring-data-rest/issues/35#issuecomment-294672899, or mute the thread https://github.com/notifications/unsubscribe-auth/AGiCi6yPrlw-0oU56itMBhuvNARFEPYDks5rxDsugaJpZM4M-3Ia .

mattvalli avatar Apr 18 '17 04:04 mattvalli

I'm using the Spring Boot too. Thanks for all your help. Will investigate the problem.

kkolli1127 avatar Apr 18 '17 05:04 kkolli1127

Hi @kkolli1127

sorry for my late response. Looks like @mattvalli said: an issue with the back end server configuration of the /totalcharges/749/communityInfo endpoint. Did you have more insights or did you solve it?

@mattvalli Thanks a lot for the help! Really appreciated!

Thanks and regards

Guy

guylabs avatar May 04 '17 20:05 guylabs