Skip to main content

phonebooks

Creates, updates, deletes, gets or lists a phonebooks resource.

Overview​

Namephonebooks
TypeResource
Idovh.sms.phonebooks

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
namestringPhonebook name
book_keystringIdentifier of the phonebook (wire: bookKey)
phone_keystringPhone key identifier between the phone and phonebooks (wire: phoneKey)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectbook_key, service_nameGet a phonebook. Returns the name and the identifier (bookKey) of the phonebook. Its contacts are listed with the phonebookContact route.
listselectservice_namex_pagination_modeList phonebooks. Returns the identifiers (bookKey) of the phonebooks of the SMS account. A phonebook stores contacts with their phone numbers.
createinsertservice_name, nameCreate a phonebook. Creates a phonebook with a name. Returns its identifier (bookKey), used to add or import contacts.
updateupdatebook_key, service_nameUpdate a phonebook. Updates the name of the phonebook. The contacts are updated one by one with the phonebookContact route.
deletedeletebook_key, service_nameDelete a phonebook. Deletes the phonebook and its contacts. Export the contacts first to keep a copy of them.
importexecbookKey, serviceName, documentIdImport contacts. Imports contacts into the phonebook from an Excel (.xls, .xlsx) or CSV file in /me/document. Returns the task that performs the import.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
bookKeystringIdentifier of the phonebook
book_keystringIdentifier of the phonebook (wire: bookKey)
serviceNamestringThe internal name of your SMS offer
service_namestringThe internal name of your SMS offer (wire: serviceName)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Get a phonebook. Returns the name and the identifier (bookKey) of the phonebook. Its contacts are listed with the phonebookContact route.

SELECT
name,
book_key,
phone_key
FROM ovh.sms.phonebooks
WHERE book_key = '{{ book_key }}' -- required
AND service_name = '{{ service_name }}' -- required
;

INSERT examples​

Create a phonebook. Creates a phonebook with a name. Returns its identifier (bookKey), used to add or import contacts.

INSERT INTO ovh.sms.phonebooks (
name,
service_name
)
SELECT
'{{ name }}' /* required */,
'{{ service_name }}'
;

UPDATE examples​

Update a phonebook. Updates the name of the phonebook. The contacts are updated one by one with the phonebookContact route.

UPDATE ovh.sms.phonebooks
SET
name = '{{ name }}'
WHERE
book_key = '{{ book_key }}' --required
AND service_name = '{{ service_name }}' --required;

DELETE examples​

Delete a phonebook. Deletes the phonebook and its contacts. Export the contacts first to keep a copy of them.

DELETE FROM ovh.sms.phonebooks
WHERE book_key = '{{ book_key }}' --required
AND service_name = '{{ service_name }}' --required
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Import contacts. Imports contacts into the phonebook from an Excel (.xls, .xlsx) or CSV file in /me/document. Returns the task that performs the import.

EXEC ovh.sms.phonebooks.import
@bookKey='{{ bookKey }}' --required,
@serviceName='{{ serviceName }}' --required
@@json=
'{
"documentId": "{{ documentId }}"
}'
;