Need help to understand API

  • Hi,
    I would like to make use of the Computer/Put API call, but I don't really understand how to use it. My understanding of the semantics of HTTP PUT requests is that you can use them to add new items or update. If we are adding a new item how would we know which id to assign to it. (The call has a required integer ID paramater in the URL). Wouldn't those ID values be auto-generated in the DB when creating a new computer item?

    Furthermore there is an additional id field in the request body. Does this also need to be set? What would it mean if it were different from the id value in the URL?


  • Post is create, put is update.

    When using put you need the id to identify the object to update.

    You shouldn't need to put the id in the body,.

  • @clonedeploy_admin Thanks, I figured it was something like that.