title: ATTask API - Updating Custom Field with API and C Sharp
body: <p>I have the API functioning fine within my project for non custom fields, but the documentation doesn't really seem to work in relation to explaining what the actual put request format should be for updating a custom field using c sharp.</p>
  
  <p>I have the following:</p>
  
  <p>Custom Field of type PROJECT called "TestNumber". </p>
  
  <p>I can easily search it with the web request: </p>
  
  <pre><code>/attask/api/proj/search?sessionID=XXXXXXX&amp;ID=XXXXX&amp;fields=DE:TestNumber
  </code></pre>
  
  <p>so I know that the syntax for that specific custom field is right. </p>
  
  <p>I can also do a basic update on non custom fields:  </p>
  
  <pre><code>/attask/api/proj?method=put&amp;sessionID=XXXXX&amp;id=XXXXX&amp;name=TEST RESOURCES` 
  </code></pre>
  
  <p>and it properly updates.</p>
  
  <p>But no matter what I do, I cannot figure out how to change the value of that "TestNumber" custom field, to a value that I choose using the API. After some searching, I found that I should be using the "JSON Edits" portion from the API docs of AtTask, however, I can't seem to figure out the proper syntax.</p>
  
  <p>My fullurl prior to the attempt is: </p>
  
  <pre><code>/attask/api/proj?method=put&amp;sessionID=XXXXX&amp;id=XXXXXX&amp;updates={DE:TestNumber:1234}
  </code></pre>
  
  <p>(which seems to jive with the API DOCS rec here <a href="http://developers.attask.com/api-docs/#JSONEdits" rel="nofollow noreferrer">http://developers.attask.com/api-docs/#JSONEdits</a>) but I get a <strong>500 Internal Server error</strong> every time.</p>
  
  <p>I have verified that I am being properly logged in.</p>
  
  <p>Any suggestions or advice would be greatly appreciated.</p>
  
  <p><strong>UPDATE:</strong>
  I still cannot get this to work. I found another post (search for "AtTask API Updating Multiple Values in Custom Checkbox Field") where the person mentioned this for a custom checkbox form: </p>
  
  <pre><code>PUT /attask/api/v3.0/task/xxxxxxxxxxxxxxxxxx?updates={DE:Labels=["a","b","c"]}
  </code></pre>
  
  <p>but I am not sure how to even pass that sort of data directly using C Sharp because it does not allow double quotes and when I add an escape character, I still get the <strong>500 internal server error</strong>. I got the "Post" method to go by using <code>%22</code> in the place of the quotes, but no matter what I do on the put, it does not work.</p>
  
  <p>Our AtTask consultant mentioned that I might need to include my categoryId for the custom form, so I also added that to my querystring, but to no avail.</p>
  
  <p>I have downloaded the "AtTask Example" for C Sharp (which is located on the developers.attask.com)and am trying to use the Update method that they use as the example passing the following:</p>
  
  <pre><code>JToken project = client.Update(ObjCode.PROJECT, new { 
      ID = projectId, categoryID = "XXXXXXXXXXXXXXXX", 
      updates = "{DE:Total Feet of Line:1234}" });
  </code></pre>
  
  <p>As I mentioned before, the Search works fine and returns exactly what I expect: </p>
  
  <pre><code>JToken projects = client.Search(ObjCode.PROJECT, new { 
      ID = projectId, 
      fields = "DE:Total Feet of Line" });
  </code></pre>
  
  <p>That generates the following url: </p>
  
  <pre><code>/attask/api/proj/search?sessionID=XXXX&amp;ID=XXXX&amp;categoryID=XXXXX&amp;fields=DE:Total Feet of Line
  </code></pre>
  
  <p>I finally tried updating using "Json Edits" with non custom fields, and it works with the put method so I MUST have something wrong with my syntax on those fields, but I was CERTAIN that it is supposed to be <code>DE:FIELDNAME:"VALUE"</code>. Am I wrong here?</p>
  
  <p>I feel like I am on the correct track in terms of trying to solve this, but am finding it hard to believe that there is no support or other people who have done this. It seems like it is a basic need to be able to update a custom field from the API... </p>
  
  <p>I also tried exactly following the other individuals example with a custom checkbox, and even though the "Search" returns the json as expected, the "Update" fails.</p>