简体   繁体   中英

Artifactory: REST API bad design

When making a PUT request to create a new (local/remote/virtual) repository, the REST API of Artifactory will return:

  • status 200 when creation is successful
  • status 400 with the keywords already exists in the response content if the resource already exists

However , when performing the same operations on users/groups/permissions , the response is 201 in both cases, whether the resource

  • exists or
  • has just been created

Response content is the same also!

Isn't this a bad api design?

There is a difference between the REST API's.

The Repository creation is marked as "Create Repository" for the PUT call and the update repository is done by using POST.

In the Users / Groups / Permissions, the REST API, using PUT, is used to "Create or Replace User" as you can see in JFrog Artifactory Wiki page for REST API .

For that reason, even if the user exists in Artifactory, you will get a 201 as a reply to the REST API command will "replace" the existing user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM