rest

RESTful URLs for distinct versions of a resource

非 Y 不嫁゛ 提交于 2021-02-06 20:02:33
问题 I'm having a real hard time conceptually understanding something proper concerning URLs for versioned resources. Let's say I have an application that tracks recipes in a way very similar to a version control system, like old school like RCS or something. Each version can be a working copy for some time then have a new version created from it. Each version has comments associated with it and doesn't share comments. I can go back historically at any time and look at the recipe as it evolved,

Do I violate RESTfulness when using POST as UPDATE OR CREATE

老子叫甜甜 提交于 2021-02-06 15:22:17
问题 Given the requirement other departments have for our REST API they would like to use POST not just for CREATE but for UPDATE OR CREATE . I know in a RESTful API PUT could or should be used for that, but because clients have to update information that is used to build the URI, we cannot use that. It would change the URI and make PUT not idempotent anymore... (the old URI would not exist after the first PUT ). tl;dr we cannot use PUT In the HTTP/1.1 specs POST is defined as The POST method is

Do I violate RESTfulness when using POST as UPDATE OR CREATE

混江龙づ霸主 提交于 2021-02-06 15:21:02
问题 Given the requirement other departments have for our REST API they would like to use POST not just for CREATE but for UPDATE OR CREATE . I know in a RESTful API PUT could or should be used for that, but because clients have to update information that is used to build the URI, we cannot use that. It would change the URI and make PUT not idempotent anymore... (the old URI would not exist after the first PUT ). tl;dr we cannot use PUT In the HTTP/1.1 specs POST is defined as The POST method is

Guzzle HTTP - add Authorization header directly into request

孤街浪徒 提交于 2021-02-06 14:43:48
问题 Can anyone explain how to add the Authorization Header within Guzzle? I can see the code below works for adding the username & password but in my instance I just want to add the Authorization header itself $client->request('GET', '/get', ['auth' => ['username', 'password'] The Basic Authorization header I want to add to my GET request :- Basic aGdkZQ1vOjBmNmFmYzdhMjhiMjcwZmE4YjEwOTQwMjc2NGQ3NDgxM2JhMjJkZjZlM2JlMzU5MTVlNGRkMTVlMGJlMWFiYmI= 回答1: From the looks of things, you are attempting to

How to get the User from the subscription-key using Azure API Management REST API?

前提是你 提交于 2021-02-06 13:56:49
问题 On Azure API Management, I would like to use the subscription-key passed from the proxy to the service to identify the user behind the call. The only solution I can find is to get all subcriptions and filter on the primaryKey or the secondaryKey to finaly find the user with this REST API but it will be too long because I will have a lot of subscriptions. https://xxx.management.azure-api.net/subscriptions?api-version=2014-02-14 When I activate the trace to see how the message is handled by the

How to get the User from the subscription-key using Azure API Management REST API?

≯℡__Kan透↙ 提交于 2021-02-06 13:56:05
问题 On Azure API Management, I would like to use the subscription-key passed from the proxy to the service to identify the user behind the call. The only solution I can find is to get all subcriptions and filter on the primaryKey or the secondaryKey to finaly find the user with this REST API but it will be too long because I will have a lot of subscriptions. https://xxx.management.azure-api.net/subscriptions?api-version=2014-02-14 When I activate the trace to see how the message is handled by the

How can I prevent other iOS/Android apps from using my RESTful API?

我是研究僧i 提交于 2021-02-06 11:46:05
问题 I have a pre-existing iOS & Android app, that I'm making an update for that includes a RESTful services API and Facebook login for user authentication. The general flow of the app is: Users "logs in" to my app, via Facebook's SDKs, which return an access token to my app. App calls a RESTful service, including the Facebook access token as a parameter (using HTTPS and SSL) Service that is called, sends the received access token (and app secret stored only on my servers) to Facebook to verify

Error handling with CXF interceptors - changing the response message

馋奶兔 提交于 2021-02-06 11:34:19
问题 I'm trying to handle errors coming from my backend. The handleMessage() is called if an error occurs but the content is an instance of XmlMessage. I would like to change it to my own response - just set the response code and add some message. I haven't found any proper documentation which could tell me how to do this... These axamples are for REST but I'd like to manage this thing in SOAP too. interceptor public class ErrorHandlerInterceptor extends AbstractPhaseInterceptor<Message> { public

javax.ws.rs.client.Client how to configure readTimeOut?

偶尔善良 提交于 2021-02-06 09:58:24
问题 Going from com.sun.jersey.api.client.Client to javax.ws.rs.client.Client how do I configure Client? FROM: import com.sun.jersey.api.client.Client; Client client = Client.create(); client.setReadTimeout(1000 * 60 * 20); client.setConnectTimeout(1000 * 20); webResource = client.resource("someWhereOverTheRainbow"); ..etc. TO: import javax.ws.rs.client.*; Client client = ClientBuilder.newClient(); // **now what?** client.getConfiguration().getProperties().put("isThisTheWayToDoIt", 1000 * 60 * 2);

Zend Framework 1.9.2+ Zend_Rest_Route Examples

我是研究僧i 提交于 2021-02-06 09:19:12
问题 With the introduction of Zend_Rest_Route in Zend Framework 1.9 (and its update in 1.9.2) we now have a standardized RESTful solution for routing requests. As of August 2009 there are no examples of its usage, only the basic documentation found in the reference guide. While it is perhaps far more simple than I assume, I was hoping those more competent than I might provide some examples illustrating the use of the Zend_Rest_Controller in a scenario where: Some controllers (such as