Answers.Body: <p>@Zeno when you have create option you don't have to look for replace </p>
  
  <p>please use create key word to create new or to update the record if record exist </p>
  
  <pre><code>$result = civicrm_api3('Address', 'create', array(
    'sequential' =&gt; 1,
    'contact_id' =&gt; 202,
    'location_type_id' =&gt; "Work",
    'street_address' =&gt; "test",
    'street_number_suffix' =&gt; 506,
  ));
  </code></pre>
  
  <p>Please try the above - This will work </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-01T12:56:18.130Z
Answers.LastActivityDate: 2016-06-01T12:56:18.130Z
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Body: <p>I'm testing the API in order to update some addressee informations (eg. the street_number) using the API Explore page.
  In any test:</p>
  
  <pre><code>CRM.api3('Address', 'replace', {
    "id": 204,
    "street_number": 556
  }).done(function(result) {
    // do something
  });
  </code></pre>
  
  <p>or </p>
  
  <pre><code>CRM.api3('Address', 'replace', {
    "contact_id": 202,
    "location_type_id": "Casa",
    "street_number_suffix": 556
  }).done(function(result) {
    // do something
  });
  </code></pre>
  
  <p>I obtain the following result:</p>
  
  <pre><code>{
  
      "is_error": 1,
      "error_message": "Mandatory key(s) missing from params array: values"
  }
  </code></pre>
  
  <p>How can I set the key?</p>
  
Tags: <api><addresses>
Title: API for update an address
ThreadText: # API for update an address
  
  (Asked by: username_0 on 2016-06-01)
  
  I'm testing the API in order to update some addressee informations (eg. the street_number) using the API Explore page.
  In any test:
  CRM.api3('Address', 'replace', {
    "id": 204,
    "street_number": 556
  }).done(function(result) {
    // do something
  });
  
  or 
  CRM.api3('Address', 'replace', {
    "contact_id": 202,
    "location_type_id": "Casa",
    "street_number_suffix": 556
  }).done(function(result) {
    // do something
  });
  
  I obtain the following result:
  {
  
      "is_error": 1,
      "error_message": "Mandatory key(s) missing from params array: values"
  }
  
  How can I set the key?
  
  **Tags:** api, addresses
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-06-01. Score: 4
  
  @username_0 when you have create option you don't have to look for replace 
  please use create key word to create new or to update the record if record exist 
  $result = civicrm_api3('Address', 'create', array(
    'sequential' => 1,
    'contact_id' => 202,
    'location_type_id' => "Work",
    'street_address' => "test",
    'street_number_suffix' => 506,
  ));
  
  Please try the above - This will work
  
  
  ---
  
  