WebApplicationException vs Response

Why to use one possibility over the other since the result is the same? Maybe because as a (Java) programmer you are accustomed with throwing exceptions when particular rules of the application are broken? Convert some string to a number and you might get a NumberFormatException, use a wrong index in an array and you … Read more

Change the array/collection order using a REST API

Following the REST Uniform Interface constraint, the HTTP PUT and PATCH methods have to stick to the standard semantics, so you can do that with either one in the following way: With PUT, clients can upload a whole new representation with the order they want. They will request GET /api/v1/items, change the order as they … Read more

HTTP Status Code for Resource not yet available

409 Conflict The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body SHOULD include enough information for the user to … Read more

How to parse list of JSON objects surrounded by [] using Retrofit and GSON?

Recently I just finish one project related to retrofit2. Based on my source, I copy all your stuff into my project to give a try, making some minor change, it works well on my side. In your build.gradle, add those: compile ‘com.squareup.retrofit2:retrofit:2.0.1’ compile ‘com.google.code.gson:gson:2.6.2’ compile ‘com.squareup.okhttp3:okhttp:3.1.2’ compile ‘com.squareup.retrofit2:converter-gson:2.0.1’ compile ‘com.squareup.okhttp3:logging-interceptor:3.2.0′ Model: (UPDATE: Follow tommus’s case, … Read more

How should a client pass a facebook access token to the server?

If you look at the API endpoints provided by all popular OAuth providers (Google, Facebook, Pocket, Git etc), you’d see that they all have HTTPS endpoints. The ways in which you can pass an access token to the provider are – i) As Query Parameter – https://yourwebsite.com/api/endpoint?access_token=YOUR_ACCESS_TOKEN ii) In the request header – GET /api/users/123/profile … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)