Forum Discussion

Micheal2's avatar
4 years ago

Update some fields in exisiting contact

Hi guys,

 

I am making API call to update the contact with JSON below:

 {
                    "UID": "5f81f864-bd3a-4086-9f75-c728f194119d",
                    "LastName": "Quyet",
                    "FirstName": "Michael",
                    "IsIndividual" : true,                                     
                    "Addresses": [
                        {
                            "Location": 1,
                            "Street": "27a Commercial Rd",
                            "City": "Newstead",
                            "State": "Qld",
                            "PostCode": "4006",                            
                            "Phone1": "0411414414",                           
                            "Email": "help@thecatalysisgroup.com.au",
                            "Website": "www.thecatalysisgroup.com.au",
                            "ContactName": "Michael Quyet"
                        }
                    ],                    
                    "SellingDetails": {                       
                        "ABN" : "",
                        "TaxCode": {
                            "UID": "3bd2fbea-54d7-4115-8030-b84360048465"
                        },
                        "FreightTaxCode": {
                            "UID": "3bd2fbea-54d7-4115-8030-b84360048465"
                        }
                   },                      
                    "RowVersion": "5083169798557270016"
                }

API call: [PUT] https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/Contact/Customer/5f81f864-bd3a-4086-9f75-c728f194119d

 

Yes, it will update the fields I listed on JSON. However, other fields that are not listed in the JSON, will be overwritten as empty. How can I update only the fields I listed in JSON above and keep other fields as original data?

 

Thanks in advance.

 

Micheal 

  • Hi Micheal2

     

    Thank you for reaching out, We would need to include the full body in the PUT request even if we are not updating all the fields. This will stop those fields from being removed.

     

    Thanks,

  • Han-Solo's avatar
    Han-Solo
    MYOB Moderator

    Hi Micheal2

     

    Thank you for reaching out, We would need to include the full body in the PUT request even if we are not updating all the fields. This will stop those fields from being removed.

     

    Thanks,