Link Search Menu Expand Document

Updated Fri Mar 5th 2021, 12:17 UTC

Update Contact

PUT /contacts/:contact

Update an existing Contact

Examples

Updating the contact with an array of phones

Request

PUT /contacts/DQeeO69

Body

{
  "name": "Cordell Walker",
  "phones": [
    {
      "number": "1-720-333-1234",
      "type": "Mobile"
    },
    {
      "number": "1-720-333-1235",
      "type": "Mobile"
    },
    {
      "number": "1-303-123-4567 x2921",
      "type": "Work"
    }
  ],
  "data": {
    "businessName": "McDonalds",
    "tags": ["cashier", "burger flipper", "fry cook"]
  }
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /contacts/DQeeO69
     -d '{json: "body"}' 

Response

Status

200

Response Type

Contact

Example
{
  "@type": "Contact",
  "id": "/contacts/DQeeO69",
  "@context": "/contexts/Contact.jsonld",
  "name": "Paul Sadauskas",
  "firstName": "Paul",
  "lastName": "Sadauskas",
  "phones": {
    "@type": "hydra:Collection",
    "id": "/contacts/DQeeO69/phones",
    "@context": "/contexts/hydra:Collection.jsonld",
    "totalItems": 3,
    "members": [
      {
        "@type": "ContactPhone",
        "id": "/contact_phones/mxvbRw",
        "@context": "/contexts/ContactPhone.jsonld",
        "phoneNumber": "+13035551234",
        "formattedPhoneNumber": "(303) 555-1234",
        "extension": null,
        "type": "Mobile",
        "deliverabilityStatus": "unknown",
        "contact": "/contacts/DQeeO69"
      },
      {
        "@type": "ContactPhone",
        "id": "/contact_phones/mxvbRw",
        "@context": "/contexts/ContactPhone.jsonld",
        "phoneNumber": "+13035551234",
        "formattedPhoneNumber": "(303) 555-1234",
        "extension": "2921",
        "type": "Mobile",
        "deliverabilityStatus": "unknown",
        "contact": "/contacts/DQeeO69"
      }
    ]
  },
  "notes": {
    "@type": "hydra:Collection",
    "id": "/contacts/DQeeO69/notes",
    "@context": "/contexts/hydra:Collection.jsonld",
    "totalItems": 0,
    "members": []
  },
  "data": {
    "businessName": "McDonalds",
    "tags": [
      "cashier",
      "burger flipper",
      "fry cook"
    ]
  },
  "conversations": "/contacts/DQeeO69/conversations",
  "createdAt": "2020-01-06T21:49:58.312Z"
}

Updating the contact with a collection of phones

Request

PUT /contacts/DQeeO69

Body

{
  "name": "Cordell Walker",
   "phones": {
     "@type": "hydra:Collection",
     "id": "/contacts/DQeeO69/phones",
     "@context": "/contexts/hydra:Collection.jsonld",
     "totalItems": 3,
     "members": [
        {
          "@type": "ContactPhone",
          "id": "/contact_phones/mxvbRw",
          "@context": "/contexts/ContactPhone.jsonld",
          "phoneNumber": "+13035551234",
          "formattedPhoneNumber": "(303) 555-1234",
          "extension": null,
          "type": "Mobile",
          "deliverabilityStatus": "unknown",
          "contact": "/contacts/DQeeO69"
        }
     ]
   },
  "data": {
    "businessName": "McDonalds",
    "tags": ["cashier", "burger flipper", "fry cook"]
  }
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /contacts/DQeeO69
     -d '{json: "body"}' 

Response

Status

200

Response Type

Contact

Example
{
  "@type": "Contact",
  "id": "/contacts/DQeeO69",
  "@context": "/contexts/Contact.jsonld",
  "name": "Paul Sadauskas",
  "firstName": "Paul",
  "lastName": "Sadauskas",
  "phones": {
    "@type": "hydra:Collection",
    "id": "/contacts/DQeeO69/phones",
    "@context": "/contexts/hydra:Collection.jsonld",
    "totalItems": 3,
    "members": [
      {
        "@type": "ContactPhone",
        "id": "/contact_phones/mxvbRw",
        "@context": "/contexts/ContactPhone.jsonld",
        "phoneNumber": "+13035551234",
        "formattedPhoneNumber": "(303) 555-1234",
        "extension": null,
        "type": "Mobile",
        "deliverabilityStatus": "unknown",
        "contact": "/contacts/DQeeO69"
      },
      {
        "@type": "ContactPhone",
        "id": "/contact_phones/mxvbRw",
        "@context": "/contexts/ContactPhone.jsonld",
        "phoneNumber": "+13035551234",
        "formattedPhoneNumber": "(303) 555-1234",
        "extension": "2921",
        "type": "Mobile",
        "deliverabilityStatus": "unknown",
        "contact": "/contacts/DQeeO69"
      }
    ]
  },
  "notes": {
    "@type": "hydra:Collection",
    "id": "/contacts/DQeeO69/notes",
    "@context": "/contexts/hydra:Collection.jsonld",
    "totalItems": 0,
    "members": []
  },
  "data": {
    "businessName": "McDonalds",
    "tags": [
      "cashier",
      "burger flipper",
      "fry cook"
    ]
  },
  "conversations": "/contacts/DQeeO69/conversations",
  "createdAt": "2020-01-06T21:49:58.312Z"
}

© 2021 TextUs