WebAPI/ContactsAPI: Difference between revisions

Jump to navigation Jump to search
Line 36: Line 36:
Update contact example:
Update contact example:


  // "contact" is the same contact object as in the save example above. The contact must have it's ID field set to update it.
  // "contact" is the same contact object as in the save example above. The contact must have its ID field set to update it.
  // Note that when updating array fields (like telephones) all the phone numbers must be specified, not just the one you want to update.
  // Note that when updating array fields (like telephones) all the phone numbers must be specified, not just the one you want to update.
  contact.tel = [{type: ["home"], value: "8675309", carrier: "myCarrier", pref: 1}, {type: ["home", "custom type"], value: "1234567", pref: 0}];
  contact.tel = [{type: ["home"], value: "8675309", carrier: "myCarrier", pref: 1}, {type: ["home", "custom type"], value: "1234567", pref: 0}];
Line 51: Line 51:
Remove/delete contact example:
Remove/delete contact example:


  // "contact" is the same contact as in the create and update examples. A contact object must have it's ID property set in order to remove it.
  // "contact" is the same contact as in the create and update examples. A contact object must have its ID property set in order to remove it.
  var request = navigator.mozContacts.remove(contact);
  var request = navigator.mozContacts.remove(contact);
   
   
Confirmed users
120

edits

Navigation menu