1

Topic: REST API, practical questions

We saw REST-services for the project. We try to follow  for RESTful-architecture, but sometimes it is impossible. Here, for example, recently the colleague added a method with such signature: [HttpPost] [Route ("ValueSet / $ expand")] public FHIR.Model. Bundle GetValueSetMembersByOIDs (IEnumerable <string> oids) On what I to it noted that the method requesting the data, should use GET-inquiry, instead of POST. The colleague disagrees, I declare supposedly "many times so did also all normally". A question - and whether such focuses in the correct REST-services are admissible? Well i.e. me here such jamb on the one hand is evident, but at the same time I could not find the prohibition of usage POST of requests in descriptions of REST-architecture instead of GET, for request of the data. Further. I called their technical lead and it explained me the reason of such code - in kach-ve parameter to request the array of identifiers is transferred. Each identifier - about 30 characters. If to transfer them as GET-inquiry parameters easily array from 60 identifiers occupies already pair kilobyte and they are not assured, whether exceeds it of limits of length of HTTP-inquiry. Here the second, more important question - as such things become humanly? Here if it is necessary to support GET-inquiries, in which the length of arguments pulls kilobyte on heels how to be? To demand to break requests? Or to spit and request the data through POST-inquiry, transferring parameters in a request body? Or to adjust a Web server, to increase the maximum length of request? Advise. Somebody for certain after all came up against a situation when for request of the data it is necessary to transfer some tens parameters. Can any examples is among well-known REST-services?

2

Re: REST API, practical questions

Hello, Artem Korneev, you wrote: AK> the Question - and whether such focuses in the correct REST-services are admissible? Well i.e. me here such jamb on the one hand is evident, but at the same time I could not find the prohibition of usage POST of requests in descriptions of REST-architecture instead of GET, for request of the data. Considering all  the http-report - yes. If url can become more than 2048 characters we not very well transfer an array or some parameters are simple - it is necessary to us  post. Here e.g. if the user name can exceed 1000 both a surname more than 1000 and all remaining part url=96 characters, and we should make request  ?name=xxx&secondname=yyy - it is necessary to do only post request. If to alter http, for the modern web on correct http get - it is necessary  generally. http post it is necessary  as now http get, i.e.  for a while specified by the server. To http post to add a flag (IsUrlCanBeWrittenByHands) - specially for browsers and the searchers, specifying that it is necessary to show this request to the user  read url.

3

Re: REST API, practical questions

Hello, Artem Korneev, you wrote: AK> Here the second, more important question - as such things become humanly? Here if it is necessary to support GET-inquiries, in which the length of arguments pulls kilobyte on heels how to be? To demand to break requests? Or to spit and request the data through POST-inquiry, transferring parameters in a request body? Or to adjust a Web server, to increase the maximum length of request? AK> advise. Somebody for certain after all came up against a situation when for request of the data it is necessary to transfer some tens parameters. Can any examples is among well-known REST-services? Generally speaking POST it is intended for creations of objects, i.e. for the sake of  effects. A special crime to adjust it for obtaining of objects in a case when on  many query parameters too go I do not see. But it is desirable to reconsider architecture, for example when it is necessary to make requests on  from 1 to 10 to make out in the form of ranges and to push in querystring. Here it is possible to have a look arguing.

4

Re: REST API, practical questions

Hello, #John, you wrote: J> If to alter http, for the modern web on correct http get - it is necessary  generally. J> http post it is necessary  as now http get, i.e.  for a while specified by the server. J> to http post to add a flag (IsUrlCanBeWrittenByHands) - specially for browsers and searchers, J> specifying that it is necessary to show this request to the user  read url. Here there are operations, general-purpose for any object - to receive, add, delete and change. What for it is necessary to delete operation to "receive", basic as a matter of fact?

5

Re: REST API, practical questions

Hello, Sharov, you wrote: S> Here there are operations, general-purpose for any object - to receive, add, delete and change. What for it is necessary to delete operation to "receive", basic as a matter of fact? Because in the modern web http  not to destination. Has once been created ftp the protocol for an exchange of documents through a server and at it were  logical  for a manipulation docks on a server. But last some time, people saw that ftp it is too difficult: it would be necessary to download the document, then to analyze its title contained, to pick up the program which understood the document, to open, read. These people liked to view hypertext pages (html+), instead of  so all  words would be , titles are underlined and it was possible to pass quickly easily to other documents under links.  during too time someone invented a mouse and to these people . It was pleasant it . And they decided to create more simple protocol which would work as ftp, but only for review of documents of certain type: hypertext pages. Transited time (developed html - new tags were added), people wanted to interpose  () in html, and also to change contents of these documents that people always would receive the most actual information: methods put, delete and that  I can withstand  in 10 have been added, at  , was  a method post. But at that time, our great-grandfathers and not , in what their innocent joke with hypertext to pages can turn. Once (the future creator js) thought: users load static pages, but they such boring: "It would be class, if  springed upwards-downwards, and the text blinked." "Here I will abruptly play the companion" - the person thought and created js. If  html+http+js only knew that in the beginning 21 centuries, computers will download not entrusted, not checked up, not  executable code (js) which will manipulate user data. And on js will form high-grade ria single page mvpmvvmmvc applications with rest-full by a server architecture, they never, never so did not joke. If it is short: http - did not form under needs of the modern web, and has been adapted from an innocent joke.

6

Re: REST API, practical questions

Hello, #John, you wrote: J> Hello, Sharov, you wrote: S>> Here there are operations, general-purpose for any object - to receive, add, delete and change. What for it is necessary to delete operation to "receive", basic as a matter of fact? J> because in the modern web http  not to destination. J> if it is short: J> http - did not form under needs of the modern web, and has been adapted from an innocent joke. REST just also it urged to correct it and somehow to arrange.

7

Re: REST API, practical questions

Hello, Artem Korneev, you wrote: AK> Advise. Somebody for certain after all came up against a situation when for request of the data it is necessary to transfer some tens parameters. Can any examples is among well-known REST-services? Solved this problem two methods: It was played with parameters in Web.config <system.web>... <httpRuntime targetFramework = "4.5.1" maxUrlLength = "10999" maxQueryStringLength = "2097151"/>... </system.web> Transferred parameters in service in coded form, on a maximum removing the superfluous information (there much that it is possible to reduce and throw out). The argument at a service method was simple line which  and turned reversely to an array. Like "<an amount id> _ <id1> _ <id2>" and it fine reduced Something length URL.

8

Re: REST API, practical questions

Hello, Vladek, you wrote: V> It was played with parameters in Web.config Norms. The variant if the enterprise single-page the js-appendix working in one of browsers of chrome becomes typical, versions 50.x.x.x.x, max length V> Argument at a service method was simple line which  and turned reversely to an array. Something like. Norms. A variant. As a special case for a small array. That in js it would be not necessary manually , arrays normally transfer  json arr (where ', 'a-divider').

9

Re: REST API, practical questions

Hello, #John, you wrote: J> If to alter http, for the modern web on correct http get - it is necessary  generally. J> http post it is necessary  as now http get What for such complexities? Parameter passing support in "body" quite would solve a problem with a length URL.

10

Re: REST API, practical questions

11

Re: REST API, practical questions

Hello, , you wrote: AK>> we Saw REST-services for the project. We try to follow  for RESTful-architecture, but sometimes it is impossible. Here, for example, recently the colleague added a method with such signature > Generally, if it is a question about fhir, in its specification directly all is painted how to do requests and what http-method, unless not? > According to the specification it is possible both GET and POST Yes. But there all the same POST it is used for "search", i.e. samplings on any filters, instead of it is simple for obtaining on ID. Here for request on one ID there under the specification it is required GET. And the request on several ID in the specification is not present are small additions of our platform. All the same we tend to that the request on several identifiers too should be GET.

12

Re: REST API, practical questions

Hello, Vladek, you wrote: V> It was played with parameters in Web.config In my opinion, is not present at us web.config Well or I did not find it. A template of the project at us not absolutely normal. We saw microservices under Azure Service Fabric. And it supports self-hosted WebAPI services through nuget-packages Owin. I.e. there then application is launched on cluster Azure Service Fabric and already from it starts WebAPI-service. The file web.config there is not present. Probably it is possible still in any parameters of initialization in the code to be played to achieve the same effect. But I by practical consideration installed yesterday that service normally accepts a line to 16Kb - quite enough for our needs. However, I tested it on local emulator Azure Service Fabric. But like on that it and the emulator to give about the same , as a real cloud. Anyway, all will be necessary in a cloud it to test.