[Spce-user] Bulk addition of Subscriber Numbers to 1 single subscriber

Andreas Granig agranig at sipwise.com
Wed Feb 4 06:38:53 EST 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Marc,

On 02/03/2015 05:41 PM, Marc Storck wrote:
> From the REST API Documentation I’m not sure how to do that
> exactly.
> 
> Do I have to update the whole array for “alias_numbers” or do I
> have to update the whole subscriber array?

Let's assume your subscriber id is 100, then you've two choices:

1. you fetch the resource via /api/subscribers/100 and modify the
whole resource by adding the full array of alias_numbers, then do a
PUT with application/json on the URL with the full info.

$ export APIUSER="administrator:administrator"
$ ngcp-api-get https://fqdn:1443/subscribers/100
- -> modify the result here e.g. in a local file /tmp/sub.txt
$ ngcp-api-put https://fqdn:1443/subscribers/100 < /tmp/sub.txt

2. modify the fields in the resource individually via PATCH by sending
a proper application/json-patch+json body.

$ export APIUSER="administrator:administrator"
$ echo "[{"op":"add", "path":"/alias_numbers", "value": [{"cc":"12",
"ac":"34","sn":"567890"},{"cc":"12",
"ac":"34","sn":"567891"},{"cc":"12", "ac":"34","sn":"567892"}]}]" |
ngcp-api-patch https://fqdn:1443/subscribers/100

or something like this. Untested, so might have syntax errors, but
that's basically the way to go to do it via the command line. Any
programmatical approach looks pretty much similar.

Andreas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iQIcBAEBAgAGBQJU0gTKAAoJEO/orXqLYCcElCcP/i2uKjGETEZ3abor49RYRyJf
/xm+EIBgGKiaDpt31+u7VgFCkxW2RHpwpbWx7EnYzxfTG4WLWnc89hGB7EustIRo
YbkOeXti0FEpRbBYfdO/BJFjGbIZ1Ovd+Ki+qXIr1iBgowNcaJLeshEhwvQOPjSu
9oomeMGU6KQ+Oo87T5eXtR+ob5z1VxtpKzHLK7QlL29umm9Td6UBk96PGgyjx/Ox
Fv5zs6Jl0HFl8houM8Q0uhTxYGeYavatF9LUWexCiGvp3q7pnyEm1H/lilJaWAZM
mRGCQmlap+TF0TVVceEhAJl8/5EzeZGYxnwhvNPro71qcr/P/ZLM4CzlMok7cWej
yC6Krx5uFH2/YoJtZTYFSOjU2xxq4JLF8L38aW9mYwL7IGDOCb6di1FUAkZva9vX
Mjhw1C30YaRALkmiqYRjYJ3HuInSemRZ86QGOej5A+YNZjy7fd76Iyq080tAJEG1
VaSEPReFhkg0Qabv5hElx3QunSp3fD9NqhK2BKSrKkprkfd0WRBRbpDu7pFh0p1Y
raepQ8xUrxKz6xibPxmInScWYsF/UpdVR5yxj+zX+7+Olco5JkEm4Sd7M8k5ehOY
pSeplx+6QbLoSdANBdWOVWrHbL0cdmFeaAC4kHGLeNPHSkO6InnCkujEiSs3rtnZ
yZBOo0u4t9+12c/ytH/c
=EiBD
-----END PGP SIGNATURE-----



More information about the Spce-user mailing list