Hello Experts,
Is it possible to pass request body as part of GET request?
If not, is there any way that we can mask the query parameters passed as part of GET request URI? Also, is there any limitation on the URI length.
Thanks.
It's not forbidden to use request body in GET by HTTP spec, but most APIs won't do that for both semantic and client tool support reasons. HTTP spec neither limits the URI length, but typically both web browsers and web servers do.
If you are developing a custom REST API, there is a workaround. Besides providing the regular GET method, you can add a POST method support for the content type application/x-www-form-urlencoded. Here are examples.
GET /query-results?q=select%20xxx
POST /query-results
Content-Type: application/x-www-form-urlencoded
q=select%20xxx
Both APIs function the same, but the POST method does not have the length limit.
Regards,
William
Yes, you can send a request body with GET but it should not have any meaning. If you give it meaning by parsing it on the server and changing your response based on its contents, then you are ignoring this recommendation in the HTTP/1.1 spec, section 4.3:
Can you tell what you want to achieve ?
Regards ,
Akshay
Hi William,
I have a content less object in the repository,
using the java client i am trying to upload the content , but the content uploaded is getting corrupted.
"http://inapptest.fpl.com/dctm-rest/repositories/TRANSCOMPOSE/objects/090078a380263fef/contents?format=zip"
HttpClient client = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(path);
post.addHeader("Authorization", generateAuthenticationToken());
File zipFile = new File("C:/Users/txs0om1/test/UploadProcess/sample.zip");
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addBinaryBody("file", zipFile, ContentType.create("application/x-zip-compressed"), "zipfile");
HttpEntity entity = builder.build();
post.setEntity(entity);
HttpResponse response = client.execute(post);
Could you please let me know how to set the content trough java client.
Thanks William. Will look into the inputs provided by you.
Hi Akshay,
My requirement is to develop a custom web service which can return response based on the content metadata passed as part of GET request.
Yes that is possible you can extend documentum webservices , Please refer below link to configure and DCTM -REST in your IDE and for extending or building your custom resources on top of DCTM REST Ref. REST Dev Guide
https://community.emc.com/docs/DOC-42776
Regards
I had already gone through the articles. Will go through Reference guide and post queries if any.
Thanks for your help.