Updating Custom fields added to a Project - API's

Comments

4 comments

  • Avatar
    Alex Roman

    Hi Mario,

     

    I'm not sure if this is the issue but I see an e after Custom (CustomeFieldValue should be CustomFieldValue)

    array("CustomeFieldValue:CustomField2;CustomeFieldValue"=>"Mario summary","Name"=>"Marios Test Project","Id"=>"e4035f06-a5d2-4339-981c-1f089e653395");

    it should be 

    array("CustomeFieldValue:CustomField2;CustomFieldValue"=>"Mario summary","Name"=>"Marios Test Project","Id"=>"e4035f06-a5d2-4339-981c-1f089e653395");

    Not sure if that is the cause but I did notice that would cause issue.

    0
    Comment actions Permalink
  • Avatar
    Mario Noronha

    Hey Alex

    The extra e was a typo while i was adding this issue. The code is without the "e"

    $data_array =  array("CustomFieldValue:CustomField2;CustomFieldValue"=>"mario summary","Name"=>"mario","Id"=>"e4035f06-a5d2-4339-981c-1f089e653395");

    I do not receive any error it returns the following success string

    array(6) { ["SavedId"]=> string(36) "e4035f06-a5d2-4339-981c-1f089e653395" ["SavedCount"]=> int(1) ["Success"]=> bool(true) ["SaveIdAlternate"]=> NULL ["Errors"]=> array(0) { } ["HasErrors"]=> bool(false) }

     

    but the data is not updating in the customfield2 text box. Is there a different way i need to reference the customfield2 for saving?

     

    Thanks

    Mario

    1
    Comment actions Permalink
  • Avatar
    Fernando Montes

    Hello,

    I have never use the API using an array like. The way I normally do it is using our c# client or passing in json. The json i would pass for this would be 

    {
    "Id": "e4035f06-a5d2-4339-981c-1f089e653395",
    "Name": "Marios Test Project",
    "CustomFieldValue": {
    "CustomField2": "Mario summary"
    }

    }

     

    The CustomField2 is a string within the object of CustomFieldValue within a project. So you will have to show that accordingly. I am not sure how you would do that in an array as you are doing. 

    0
    Comment actions Permalink
  • Avatar
    Mario Noronha

    Thanks Fernando,

     

    This worked for me.. Just pasting the webservice call here as it could be helpful for someone trying to update the data via services via PHP

    $make_call = callAPI('POST', 'https://prothoughts-demo.projectinsight.net/api/project/', '{"Id": "e4035f06-a5d2-4339-981c-1f089e653395","Name": "Marios Test Project","CustomFieldValue": {"CustomField2": "Mario summary 123"}}');
    $response = json_decode($make_call, true);

    echo var_dump($response);

     

    Thanks

    Mario

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk