restful-url

Alternatives of using verbs and adjectives in RESTful URL

情到浓时终转凉″ 提交于 2019-12-11 05:38:26
问题 I want to add actions to my REST API that would move 'resources' between different 'stores'. For instance, suppose my resources are normally accessed by the following URL: /resources /resources/{resourceId} Now suppose I want to 'deactivate' some resource, i.e. conceptually move it to another sub-folder. The most straightforward way to allow this would be as followed. 'Deactivate' the resource, i.e. cause it to be unavailable under /resources. Conceptually, it 'moves' the object to the '

What is best practice in a Restful laravel app for Controllers and methods

风流意气都作罢 提交于 2019-12-11 04:45:13
问题 I am developing a restful laravel application and I need to know what is the best practice to implement the routes, controllers and methods in the Laravel to both support the restful requests and HTTP web requests we can easily create a resource controller and then add the following line to the routes file in Laravel: Route::resource('Photo', 'PhotoController'); and then in the PhotoController we just need to add the following lines of codes which returns a json response from all the photos:

REST Url ID Placement for Resources with Collections

Deadly 提交于 2019-12-11 01:48:20
问题 Is this a good structure for REST URLs? Assuming: GET /account <- get list of accounts GET /account/1234 <- get account 1234 etc. If the account resource has a collection that I want to interface, is this a good idea? GET /account/1234/note <- get notes for account 1234 POST /account/1234/note <- add note to account 1234 DELETE /account/1234/note/321 <- delete note 321 on account 1234 Especially that last one gives me pause; typically I wouldn't require both the entity ID and the parent ID

How to get multiple response for single request in java web api

谁都会走 提交于 2019-12-10 23:01:56
问题 suppose i have a client which sends the request to server to generate numbers from 1 to 100 and send the response back to client. Assume that generating numbers from 1 to 100 is very tedious job and it requires lot of resources so my server will start generating the numbers and sends the numbers to client as soon as the number is generated on server, instead of generating all number and sending the response at once to client. It is something like flipkart page. if you open a page we can see

Make a REST URL call to another service by filling the details from the form

前提是你 提交于 2019-12-10 11:19:17
问题 I have recently started working with Spring MVC framework. I made a lot of progress while reading lots of tutorial on the net. Background about my application- I have to make a REST URL call to another service (deployed already on tomcat) by using details provided in the form. So I have already made a form using JSP whose content is something like this as shown in the picture- I am not sure how can I make a REST url call by making the url from the form entries and then show the response of

getting 403 forbidden error [duplicate]

江枫思渺然 提交于 2019-12-10 10:28:41
问题 This question already has answers here : 403 Forbidden with Java but not web browser? (4 answers) Closed last year . Getting 403 forbidden for below code, though "https://jsonplaceholder.typicode.com/posts/1" works in postman @ComponentScan @EnableAutoConfiguration public class Application { public static void main(String[] args) { RestTemplate rt = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); HttpEntity<String>

How to reformat URLs to be more restful (from …/?id=123 to …/123)?

纵饮孤独 提交于 2019-12-10 10:04:45
问题 Currently I have pages accessed via: www.foo.com/details.html?id=123 I'd like to make them more restful-like, such as by the following: www.foo.com/details/123 I'm using Google App Engine. Currently the URL's are mapped in the html-mappings file: ('/details.html*', DetailsPage), And then on the DetailsPage handler, it fetches the ID value via: class DetailsPage(webapp.RequestHandler): def get(self): announcement_id = self.request.get("id") How might I restructure this so that it can map the

Is it legal to have REST resource such as /currentUser in terms of RESTful and stateless?

拜拜、爱过 提交于 2019-12-09 12:38:36
问题 In terms of RESTful and stateless it's pretty legal to have resource like /users/123 But, the question is: is it legal to have resource that omits user id and assumes that it's implicitly resolved on the server from the user session? For example: /loggedUser That resource would point to /users/123 when user with identifier 123 is authorized. 回答1: Picking a resource locator Using /me , /users/me , /users/myself , /users/current or similar URIs to identify a resource that corresponds to the

a restful api only uses clean urls - no url variables or post variables

旧巷老猫 提交于 2019-12-08 08:12:56
问题 A restful api has to use either get, post, put or delete request methods. The behavaiour and data submitted is entirely determined by the uri string. No query paramters or post variables. Is this true ? Valid : http://example.com/foo/84 Not valid : http://example.com/foo/?value=84 Valid : $.ajax({ type: 'POST', url: "http://example.com/foo/84", success: success, dataType: dataType }); Not valid : $.ajax({ type: 'POST', url: "http://example.com/foo/", data: 84, success: success, dataType:

Multiple query parameter RESTful URL with .htaccess

风格不统一 提交于 2019-12-08 03:02:18
问题 I would like to use following RESTful URL for a web site I'm working on. http://mysite.com/Products/category=bags&colours=black can anyone please tell me how to achieve this with .htaccess? Oscar 回答1: Here's an .htaccess to capture anything except when files or directories conflict and it routes to /index.php: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php