restful-architecture

How to implement two level authentication in a RESTful API?

£可爱£侵袭症+ 提交于 2020-02-16 05:48:26
问题 I am writing a RESTful API for a fairly complex web application (further referred as api.mywebapp.com) The requirements include that api.mywebapp.com should handle: API level authentication (authorizing client application eg.: mobile app) User level authentication (authorizing www.mywebapp.com registered users so they can access their protected resources) Usage example: Mobile application connects to the https://api.mywebapp.com with a valid basic HTTP authorization header (Authorization:

How to implement two level authentication in a RESTful API?

﹥>﹥吖頭↗ 提交于 2020-02-16 05:47:28
问题 I am writing a RESTful API for a fairly complex web application (further referred as api.mywebapp.com) The requirements include that api.mywebapp.com should handle: API level authentication (authorizing client application eg.: mobile app) User level authentication (authorizing www.mywebapp.com registered users so they can access their protected resources) Usage example: Mobile application connects to the https://api.mywebapp.com with a valid basic HTTP authorization header (Authorization:

How to get Restful API up and running using Wt

情到浓时终转凉″ 提交于 2020-01-22 20:03:45
问题 I have a running Wt application based on the tutorials all over the web and I was wondering if there is an elegant way of using Wt to add a some Restful API functionality. I have a few resources I can expose from my current application and I don't want to implement any patches. If someone has a good idea of how to do that, or even a suggestion of some JSON library that can make the development a breeze, I'd be very thankful. 回答1: You should subclass WResource and implement the WResource:

Using optional complex type action parameter for a POST Web API

 ̄綄美尐妖づ 提交于 2020-01-14 07:15:12
问题 I am trying to write an API with the following prototype: [HttpPost] public ApplicationStatus appLogIn(string id, UserCredentials userCredentials = null) But when I make a request to this API, with or without userCredentials , I get the following error with response code as 500 { "Message": "An error has occurred.", "ExceptionMessage": "Optional parameter 'userCredentials' is not supported by 'FormatterParameterBinding'.", "ExceptionType": "System.InvalidOperationException", "StackTrace":

What does jersey service return if @Produces annotation missing?

我们两清 提交于 2020-01-04 02:54:21
问题 I was begun learn jersey for development restful web services. As I noticed in most of the examples uses following annotations: @Consumes defines format of input parameters @Produces defines format of output parameters But in real code I see method which looks like this: @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Path("/login") public Response login(@FormParam("login") final String username, @FormParam("password") final String password){...} I see that this method uses POST HTTP

Getting java.lang.NoSuchFieldError: VALUE in RamlValidationService

末鹿安然 提交于 2020-01-02 09:56:36
问题 I want to create a RAML validator that will get the RAML URLs resturn validation results. For that Im using raml-java-parser. As per its readme file I try to execute below line of code: String sourceUrl = "http://api.apihub.com/onpositive/api/espn-raml-api/espn.raml"; List<ValidationResult> results = RamlValidationService.createDefault().validate(sourceUrl); And get below error message: java.lang.NoSuchFieldError: VALUE Why I'm getting this error? Before that I got some class not found

How to catch RESTEasy Bean Validation Errors?

微笑、不失礼 提交于 2019-12-29 07:15:14
问题 I am developing a simple RESTFul service using JBoss-7.1 and RESTEasy. I have a REST Service, called CustomerService as follows: @Path(value="/customers") @ValidateRequest class CustomerService { @Path(value="/{id}") @GET @Produces(MediaType.APPLICATION_XML) public Customer getCustomer(@PathParam("id") @Min(value=1) Integer id) { Customer customer = null; try { customer = dao.getCustomer(id); } catch (Exception e) { e.printStackTrace(); } return customer; } } Here when I hit the url http:/

Restful API naming conventions [closed]

守給你的承諾、 提交于 2019-12-28 12:32:43
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . So me and my boss aren't agreeing here and can't find any information on it. Scenario: I want to get all the users for a certain organisation. What should the URL be? mydomain.com/users/by/organisation/{orgId} OR mydomain.com/organisation/{orgId}/users Our arguments: Case 1:

Glassfish built in RESTful EJB interface in addition to SOAP

二次信任 提交于 2019-12-25 05:22:29
问题 I am currently learning Glassfish and I see that it is possible to add the annotation @WebService (javax.jws.WebService) and the container will automatically enable a SOAP web service for the particular bean. Since I am not really interested in using SOAP, I was wondering if the same can be accomplished using the server built-in functionality but for a RESTful service, without explicitly writing my own. Thanks 回答1: JAX-RS (the standard) and Jersey (one implementation of this standard) is what

RESTful authentication API design

霸气de小男生 提交于 2019-12-24 14:23:38
问题 I have a question regarding RESTful API design. Following the guidelines of REST, all endpoints should be nouns and in plural, and should never be verbs. However, it is customary to have authentication routes be: /login /logout which are both verbs. If you should be true to the guidelines these routes should look more like this instead: /users?action=login /users?action=logout but I've never used any API that has this particular authentication implementation, everyone uses the first one, me