Skip to main content
POST
/
address_book.json
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Mike Howard",
      "phone": "463571393241"
    },
    {
      "name": "Morgan Fuller",
      "phone": "65021272571"
    }
  ],
  "udid": "A337E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
{
  "created": 2,
  "updated": 0,
  "deleted": 0
}

Recipes

1

1. Use a `contacts` parameter to set an array of contact hashes

curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Ann",
      "phone": "11223334237",
      "destroy": 1
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
2

2. Set a name of the contact

Note that a name is limited to a number of signs. Min: 1. Max: 25.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Ann",
      "phone": "11223334237",
      "destroy": 1
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
3

3. Set a phone of the contact

Note that a phone is limited to a number of signs. Min: 10. Max: 15.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Ann",
      "phone": "11223334237",
      "destroy": 1
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
4

4. Specify if you want to delete a contact

Set a destroy parameter as 1 to delete a contact.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Ann",
      "phone": "11223334237",
      "destroy": 1
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
5

5. Set a device identifier

Set a udid parameter to specify a user’s device. If specified, a contact will be deleted for a specified device only.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Ann",
      "phone": "11223334237",
      "destroy": 1
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
6

6. As a result, the API returns a response specifying that a contact was deleted.

curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Ann",
      "phone": "11223334237",
      "destroy": 1
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
1

1. Use a `contacts` parameter to set an array of contact hashes

curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Alex"
    },
    {
      "phone": "45645645666"
    },
    {
      "name": "",
      "phone": "456456456"
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
2

2. Set a `name` and `phone` of the contact as separate arrays

Note that it’s incorrect to set a name separately from a phone.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Alex"
    },
    {
      "phone": "45645645666"
    },
    {
      "name": "",
      "phone": "456456456"
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
3

3. Set a `name` as an empty string

Note that a name is limited to a number of signs. Min: 1. Max: 255.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Alex"
    },
    {
      "phone": "45645645666"
    },
    {
      "name": "",
      "phone": "456456456"
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
4

4. Set an incorrect phone length

Note that a phone is limited to a number of signs. Min: 10. Max: 15.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Alex"
    },
    {
      "phone": "45645645666"
    },
    {
      "name": "",
      "phone": "456456456"
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
5

5. As a result, the API returns a `200` status response specifying that the data were set incorreclty.

curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Alex"
    },
    {
      "phone": "45645645666"
    },
    {
      "name": "",
      "phone": "456456456"
    }
  ],
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
1

1. Use a `contacts` parameter to set an array of contact hashes

curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Howard",
      "phone": "12312312333"
    }
  ],
  "force":1,
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
2

2. Set a name of a contact

Note that a name is limited to a number of signs. Min: 1. Max: 255.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Howard",
      "phone": "12312312333"
    }
  ],
  "force":1,
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
3

3. Set a phone of a contact

Note that a phone is limited to a number of signs. Min: 10. Max: 15.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Howard",
      "phone": "12312312333"
    }
  ],
  "force":1,
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
4

4. Specify if you want to replace existing contacts with the one specified

Set a force as 1 to replace the contacts.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Howard",
      "phone": "12312312333"
    }
  ],
  "force":1,
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
5

5. Set a device identifier

Set a udid parameter to specify a user’s device. If specified, contacts will be replaced for a specified device only.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Howard",
      "phone": "12312312333"
    }
  ],
  "force":1,
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
6

6. As a result, the API returns a responce specifying that `1` contact was created and `3` deleted.

curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Howard",
      "phone": "12312312333"
    }
  ],
  "force":1,
  "udid": "2222E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
1

1. Use a `contacts` parameter to set an array of contact hashes

curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Mike Howard",
      "phone": "463571393241"
    },
    {
      "name": "Morgan Fuller",
      "phone": "65021272571"
    }
  ],
  "udid": "A337E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
2

2. Set a name of the contact

Use a name parameter to set the name of the contact.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Mike Howard",
      "phone": "463571393241"
    },
    {
      "name": "Morgan Fuller",
      "phone": "65021272571"
    }
  ],
  "udid": "A337E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
3

3. Set a phone of the contact

Use a phone parameter to set a phone of the contact.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Mike Howard",
      "phone": "463571393241"
    },
    {
      "name": "Morgan Fuller",
      "phone": "65021272571"
    }
  ],
  "udid": "A337E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
4

4. As a result, the API returns a `200` status response specifying that the contacts were uploaded.

curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Mike Howard",
      "phone": "463571393241"
    },
    {
      "name": "Morgan Fuller",
      "phone": "65021272571"
    }
  ],
  "udid": "A337E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
This API allows you to do following things:
  • Upload new address book.
  • Replace old address book with a new one.
  • Add/delete individual contacts.
  • Update existing contacts.

Body Parameters

contacts
array
required
Contains an array of contact objects. Each contact can contain 3 keys - phone, name, and destroy.
force
integer
Defines force rewrite mode. Set force=1 to apply, then all previous contacts for the device context will be replaced by new ones.
udid
string
User’s device identifier. If specified, all operations will be in this context. Max. length is 64 symbols. If the device identifier is not specified, it means that a user has one global address book across all their devices.

Headers

QB-Token
string
required
A user session token. See Authentication page to learn more about the session token.

Responses

A successful response
created
integer
updated
integer
deleted
integer
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 6d59d901c1231a4d74572224b88ccbc487012bba" \
-d '{
  "contacts": [
    {
      "name": "Mike Howard",
      "phone": "463571393241"
    },
    {
      "name": "Morgan Fuller",
      "phone": "65021272571"
    }
  ],
  "udid": "A337E8A4-80AD-8ABA-9F5D-579EFF6BACAB"
}' \
https://api.quickblox.com/address_book.json
{
  "created": 2,
  "updated": 0,
  "deleted": 0
}
I