Mattisdada
Mattisdada

Reputation: 997

ADO .Net RESTful partial update

I'm using a very undocumented RESTful ADO .Net service. I am trying to perform a partial update (as in, just send through the data that has changed).

My current request looks like this:

PUT https://{URL}/JobTypeMs(37294)
Headers: 
  Accept: application/json
  Content-Type: application/json

Body:
{ 
     "Jobtype_Name" : "Completed 2", 
     "Tenant_Id": "{A Long ID}",
     "Job_Color_Code": "000000"
}

What this does, is "null"/false/blank everything that I do not send through (Status and a few other columns). How do I avoid this?

Or will I be forced to do a GET request before every update to get the current columns and then change everything?

NOTE: I've never used ADO .Net before and I do not have access to the ADO .Net service to make changes to it. I can only utilize the RESTful interface. I am also not sure if this is a problem with this particular implementation of ADO .Net or if it is standard.

UPDATE: As adrift suggested, this service does not support the PATCH method

Upvotes: 0

Views: 108

Answers (1)

Jeff Ogata
Jeff Ogata

Reputation: 57783

You can try and see if the service supports PATCH:

Several applications extending the Hypertext Transfer Protocol (HTTP) require a feature to do partial resource modification. The existing HTTP PUT method only allows a complete replacement of a document. This proposal adds a new HTTP method, PATCH, to modify an existing HTTP resource.

See also this page at The RESTful Cookbook.

If the service does not support PATCH, then (as you mentioned) you will have to first GET the resource and then PUT the modified values.

As a side note, the behavior of this service isn't dependent on ADO.NET or any other technology. Any development stack could be used on the server and implemented in the same way.

Upvotes: 1

Related Questions