Questions tagged [restful-url]

Representational state transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web.

https://en.wikipedia.org/wiki/Representational_state_transfer

1351 questions
15
votes
4 answers

Log restful endpoints on container startup in a Spring application

I've a Spring application that expose restful endpoints through @RequestMapping annotation in Controller classes. I wish that were logged into the console, at server startup, all the endpoints of all the application's controller. I use a tomcat…
Alberto Giantin
  • 151
  • 1
  • 1
  • 3
15
votes
8 answers

Do REST API URLs have to look like this?

Is it true that to implement a RESTful API, one has to implement a URL structure that looks like this http://example.com/post/ http://example.com/post/123 where the /123 would be used for edit, delete Another way to ask the question is: can a URL…
Gorge
  • 1,399
  • 3
  • 9
  • 11
14
votes
3 answers

REST services - exposing non-data "actions"

I understand how to use REST for doing general entity interactions - using urls names to map to entities and the HTTP verbs to map to actions on those entities. But what is the generally accepted way of looking at "actions" more like RPC? For…
ctacke
  • 66,480
  • 18
  • 94
  • 155
14
votes
2 answers

Get PUT params with Slim PHP

I searched, but I didn't find an answer. I have a RESTful API to manage a basic CRUD. I'm trying to create an update method using PUT, but I can't retrieve the params values. I'm using Postman to make the requests, my request looks…
bodruk
  • 3,242
  • 8
  • 34
  • 52
14
votes
6 answers

PUT and POST getting 405 Method Not Allowed Error for Restful Web Services

I am trying to set up a simple Restful Web-Service which returns either JSON or XML according to the Accept header. I am using Spring, Maven and WebLogic Server. I took the example from this post…
Some Guy Really
  • 539
  • 2
  • 10
  • 19
13
votes
1 answer

How do I filter and select inside a expanded collection on Microsoft Graph?

This code works https://graph.microsoft.com:443/v1.0/me/drive/root?$filter=Size eq 0&$expand=children($select=id,folder,name,parentReference,cwebUrl)&$select=Id,folder,name,parentReference,children,webUrl I want to filter inside the…
XzaR
  • 610
  • 1
  • 7
  • 17
13
votes
3 answers

Search verb in HTTP API

What is best practice for search in API? GET + query parameters, example: GET /search?q=phone GET + parameters in body, example: GET /search {"query": "phone"} POST + parameters in body, example: POST /search {"query": "phone"}
Romper
  • 2,009
  • 3
  • 24
  • 43
13
votes
6 answers

RESTful API URI Design

I'm looking for some direction in regards to the URI design for a RESTful API. I'm going to have several nested linked resources and have currently designed my URI's similar to this post: Hierarchical RESTful URL design The following example isn't…
TimS
  • 1,113
  • 7
  • 10
12
votes
4 answers

Object of type 'TypeError' is not JSON serializable

I try to build API with Django rest framework And I got Object of type 'TypeError' is not JSON serializable What should I do to fix? Here's my view.py class NewsViewSet(viewsets.ModelViewSet): queryset = News.objects.all() serializer_class…
Ray
  • 193
  • 1
  • 1
  • 11
12
votes
4 answers

AngularJS: $resource with nested resources

I am using AngularJS $resource model to REST API. I have got something like this: angular.module('libraryapp') .factory('Book', function($resource){ return $resource('books/:id'); }); I am using in these way: Book.get({ id: 42 },…
Dariusz Mydlarz
  • 2,940
  • 6
  • 31
  • 59
12
votes
5 answers

sending array via query string in guzzle

Guzzle client creates by default from this code $client->get('https://example.com/{?a}', array('a' => array('c','d'))); this url https://example.com/?a=c,d What is the best practice to send array in query string in RESTful application? The…
Peter Krejci
  • 3,182
  • 6
  • 31
  • 49
11
votes
4 answers

Natural keys and RESTful URLs

I have a RESTful API that I'm designing which uses numeric primary keys for all of its resources. However one type of resource has a convenient natural key, which I'd like to be able to use as an optional way to specify the individual resource. For…
rectangletangle
  • 50,393
  • 94
  • 205
  • 275
11
votes
2 answers

Tree structure of data in REST - URL always from root?

Problem When the data have a tree structure of parent/child/grandchild entities, we often duplicate the information in the URL, specifying parent IDs, even if that's not necessary. What's the best way to design the RESTful API in such case? Can the…
Pavel S.
  • 11,892
  • 18
  • 75
  • 113
11
votes
4 answers

RESTful URLs for distinct versions of a resource

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…
Sloloem
  • 1,587
  • 2
  • 15
  • 37
11
votes
3 answers

How to pass comma separated parameters in a url for the get method of rest service

I have a webservice like @GET @Produces("application/json") @Path("{parameter1}/july/{param2},{param3},{param4}/month") public Month getResult(@PathParam("parameter1") String parameter1, @PathParam("param2") PathSegment param2 , @PathParam("param3")…
Ravi Mishra
  • 181
  • 1
  • 3
  • 8
1 2
3
90 91