Skip to main content
modified answer to properly answer question
Source Link
JimmyJames
  • 31.5k
  • 3
  • 61
  • 112

The simplest solution here would seem to but to call PUT on the user resource with the full setnew version of propertiesthe schema. This is a problematic in general because it's subject to dirty reads but you might be able to use it if that isn't an issue for you. There's PATCH mechanism which seems simple enough at first but start This is also unworkable for your specific scenario due to be bit heady whenthe versioning requirements that you dig a little deeperhave noted in the comments below.

Another option put beAs I understand it, a given version of each schema is immutable*. Given that requirement, I think best answer here is that when a change is made to the schema, you would do a PUT on sub-resource ofPOST to the user calledresource root and let it determine the new version number. For example, say you have resource phoneNumber/schema/user/1. I'm not sure how, if you want to modify it, the Restafariansschema is retrieved, edited and POSTed to /schema/user which will feel aboutcreate resource /schema/user/2. You could try to do some sort of PATCH action against the schema and let it create the new merged version for you but that thoughis far more difficult to implement and I don't think it would be worth it unless there is some specific need for it to happen on the server.

*You may need to make accommodations as necessary to support corrections.

The simplest solution here would seem to but to call PUT on the user resource with the full set of properties. This is a problematic in general because it's subject to dirty reads but you might be able to use it if that isn't an issue for you. There's PATCH mechanism which seems simple enough at first but start to be bit heady when you dig a little deeper.

Another option put be to do a PUT on sub-resource of the user called phoneNumber. I'm not sure how the Restafarians will feel about that though.

The simplest solution here would seem to but to call PUT on the user resource with the new version of the schema. This is a problematic in general because it's subject to dirty reads. This is also unworkable for your specific scenario due to the versioning requirements that you have noted in the comments below.

As I understand it, a given version of each schema is immutable*. Given that requirement, I think best answer here is that when a change is made to the schema, you would do a POST to the resource root and let it determine the new version number. For example, say you have resource /schema/user/1, if you want to modify it, the schema is retrieved, edited and POSTed to /schema/user which will create resource /schema/user/2. You could try to do some sort of PATCH action against the schema and let it create the new merged version for you but that is far more difficult to implement and I don't think it would be worth it unless there is some specific need for it to happen on the server.

*You may need to make accommodations as necessary to support corrections.

Source Link
JimmyJames
  • 31.5k
  • 3
  • 61
  • 112

The simplest solution here would seem to but to call PUT on the user resource with the full set of properties. This is a problematic in general because it's subject to dirty reads but you might be able to use it if that isn't an issue for you. There's PATCH mechanism which seems simple enough at first but start to be bit heady when you dig a little deeper.

Another option put be to do a PUT on sub-resource of the user called phoneNumber. I'm not sure how the Restafarians will feel about that though.