Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

put

RESTful API design: should unchangable data in an update (PUT) be optional?

December 27, 2023 by Tarik

Personally, both ways are acceptable…. however, if I were you, I’ll opt for option A (check read-only fields to ensure they are not changed, else throw an error). Depending on the scope of your project, you cannot assume what the consumers know about your Restful WS in depth because most of them don’t read documentations … Read more

Categories rest Tags put, rest Leave a comment

How to receive a file via HTTP PUT with PHP

December 24, 2023 by Tarik
Categories php Tags file, http, php, put Leave a comment

Should I use PUT method for update, if I also update a timestamp attribute

December 15, 2023 by Tarik

Ignoring the comment about the REST style mapping CRUD to the HTTP methods, this is an excellent question. The answer to your question is, yes you are free to use PUT in this scenario even though there are some elements of the resource that are updated by the server in a non-idempotent manner. Unfortunately, the … Read more

Categories rest Tags audit, logging, put, rest Leave a comment

Are PUT and POST requests required/expected to have a request body?

December 6, 2023 by Tarik

I asked this question on the Http-WG. This was the most precise answer I got http://lists.w3.org/Archives/Public/ietf-http-wg/2010JulSep/0276.html In summary, POST does not require a body. I would expect the same justification can be applied to PUT.

Categories http Tags http, httpwebrequest, post, put, rest Leave a comment

Should HTTP PUT create a resource if it does not exist?

November 27, 2023 by Tarik

First of all, you are using an obsolete document: The RFC 2616 is no longer relevant nowadays and anyone using such document as reference should stop right away. Quoting Mark Nottingham who, at the time of writing, co-chairs the IETF HTTP and QUIC Working Groups: Don’t use RFC2616. Delete it from your hard drives, bookmarks, … Read more

Categories rest Tags http, put, rest Leave a comment

Consequences of POST not being idempotent (RESTful API)

August 22, 2023 by Tarik

The only advantage of POST-creation over PUT-creation is the server generation of IDs. I don’t think it worths the lack of idempotency (and then the need for removing duplicates or empty objets). Instead, I would use a PUT with a UUID in the URL. Owing to UUID generators you are nearly sure that the ID … Read more

Categories http Tags http, idempotent, post, put, rest Leave a comment

Why don’t browsers support PUT and DELETE requests and when will they?

August 14, 2023 by Tarik

Browsers do support PUT and DELETE, but it’s HTML that doesn’t. For example, a browser will initiate a PUT request via Javascript (AJAX), but not via HTML <form> submission. This is because HTML 4.01 and the final W3C HTML 5.0 spec both say that the only HTTP methods that their form elements should allow are … Read more

Categories rest Tags put, rest Leave a comment

REST – Shouldn’t PUT = Create and POST = Update

July 23, 2023 by Tarik

The difference is that a PUT is for a known resource, and therefor used for updating, as stated here in rfc2616. The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That … Read more

Categories post Tags post, put, rest Leave a comment

Error: C# The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

July 22, 2023 by Tarik

I solved the problem with this: ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback ( delegate { return true; } );

Categories c# Tags c++, certificate, httpwebrequest, put, ssl Leave a comment

Is there any way to do HTTP PUT request in Python?

June 17, 2023 by Tarik

I’ve used a variety of python HTTP libs in the past, and I’ve settled on requests as my favourite. Existing libs had pretty useable interfaces, but code can end up being a few lines too long for simple operations. A basic PUT in requests looks like: payload = {‘username’: ‘bob’, ’email’: ‘bob@bob.com’} >>> r = … Read more

Categories python Tags http, put, python Leave a comment
Older posts
Page1 Page2 … Page4 Next →

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa