<div dir="ltr"><div><div><div><div><div>As I was writing code that performs validation for Artifacts I realized how complex the validation gets when we allow users to create Artifacts and then update them in the future, but only one time. <br><br>The upload REST API becomes strange also:<br></div><br>1. Artifact with sha256 hash 123456 is created without a file (deferred download)<br></div>2. User performs a POST to /api/v3/artifacts/ with an Artifact that has sha256 hash 123456 and gets a 400 response saying that the artifact already exists and can be updated by performing a PUT on the Artifact resource. <br></div><div>3. User performs PUT on Artifact with sha256 123456 and includes a file. The file is uploaded and Artifact is now storing a path to the file.<br></div><div>4. User performs another PUT on the file to update it again and receives a 400 response saying the Artifact cannot be modified.<br></div><div><br></div>or<br><br>1. Artifact with sha256 hash 123456 is created without a file (deferred download)</div>2. User performs a POST to /api/v3/artifacts/ with an Artifact that has sha256 hash 123456 and gets a 201 response saying the Artifact was created. <br>      - This is very misleading because the Artifact already existed<br><br><br></div><div>Neither of these scenarios is appealing to me. The REST API would be simplified if we made Artifacts immutable. Either a plugin creates an Artifact once or an Artifact is created using the REST API. After that it can only be retrieved or deleted. <br><br></div><div>Any information, such as expected size and checksum should be stored in a separate table - together with the URL of the remote artifact. We could call it RemoteArtifact. <br></div></div>