restful-url

RESTful design for an endpoint to filter and return only the latest created resource

倖福魔咒の 提交于 2021-02-11 15:33:03
问题 I have an application where a user can create many subresources for a given one. Let's say the endpoint looks like this: POST /main-resources/{id}/sub-resources The subresource contains a period of time limited by dates as part of the body, something like: { "startDate": "2018-10-10", "endDate": "2018-12-12" } They are also consider value objects. In terms of the application, they don't have an id (even though they are backup by a SQL database so effectively they have one) as it doesn't make

RESTful URLs for distinct versions of a resource

流过昼夜 提交于 2021-02-06 20:05:57
问题 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,

RESTful URLs for distinct versions of a resource

若如初见. 提交于 2021-02-06 20:04:50
问题 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,

RESTful URLs for distinct versions of a resource

╄→гoц情女王★ 提交于 2021-02-06 20:04:04
问题 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,

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

REST - Query string vs. URL path

倾然丶 夕夏残阳落幕 提交于 2021-01-25 07:30:47
问题 I am working on a Web Api application and I am currently struggling with my understanding of RESTful API Design. Let's say there is a Post resource /api/posts and I want the clients give the opportunity to request all Posts for the current month. From my understanding there are 2 ways to achieve this. One way could be to make the current month as a resource. The other way could be a query string for the Post resource. What is the best (RESTful) way to do this? api/posts/currentmonth or api

sending array via query string in guzzle

北城余情 提交于 2020-12-04 20:01:03
问题 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 question is, how can I determine on the server side whether c,d is a string or an array? Isn't it better to send arrays using square brackets, e.g. a[]=c&a[]=d ? How can I set Guzzle to use square brackets? Or it is better to use JSON encoded variables? On

sending array via query string in guzzle

人盡茶涼 提交于 2020-12-04 19:59:25
问题 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 question is, how can I determine on the server side whether c,d is a string or an array? Isn't it better to send arrays using square brackets, e.g. a[]=c&a[]=d ? How can I set Guzzle to use square brackets? Or it is better to use JSON encoded variables? On