= Subscribers Query Portax subscription database. Subscribers REST API is available at {{{$Portax::WebPath/rest/subscribers}}} == DESCRIPTION Subscribers REST resource provides simple methods to query and/or update Portax subscription database. == METHODS === GET Query subscription(s). pn:: Limit query results to PN unit_id:: Limit query results to UNIT_ID limit:: Page size from 10 to 100, default is 10 page:: Goto {{{page}}}, start from 0 offset:: Skip ''offset'' rows in response family:: {{{Cable|xTTH|PON|DSL}}} Or use :sid argument in URL. If there is warning pending, '''stash''' attribute contains previous '''inet_service''' and '''iptv_service''' settings. ==== EXAMPLE {{{ curl -s --cert-type P12 --cert $CERT:$PASS \ $URL/rest/subscribers?pn=26 }}} Response: See response fields description at [[https://portax.cz/trac/wiki/API/Tasks]]. Response contains {{{last_seen}}} attribute with last IP address renewal from particular subscriber. The {{{devices}}} element contains {{{bridge_mode}}} and {{{wifi_enabled}}} attributes if applicable. {{{ { "results": [ { "iptv_service": "disconnect", "sid": 9, "aux_ip_cnt": null, "username": "Murl", "address_key": null, "password": "tomiyu233", "first_name": "German", "alt_pn": null, "organization": null, "aux_options": null, "devices": [ { "type": "EPC3925", "class": "DS_MODEM", "uid": "38:c8:5c:89:97:a0" } ], "profile_id": null, "inet_service": "TST", "mta_ip": null, "voip_no_1": null, "zip": "49460", "sip_pass_2": null, "street": "Ben Rapid", "sip_user_2": null, "city": "Klockoton", "house": "0472", "voip_no_2": null, "sip_pass_1": null, "sip_user_1": null, "unit_id": "127", "apartment": null, "voip_service_2": "disconnect", "email": null, "fixed_ip_cnt": null, "pn": "26", "voip_type": null, "last_name": "Schneider", "phone": null, "voip_service_1": "disconnect", "last_seen": "1970-01-01 00:00:00+02" } ] } }}} [=#response2] Example response 2 (anonymized) {{{ { "results": [ { "sip_pass_2": null, "city": "...", "fixed_ip_cnt": null, "pn": "...", "devices": [ { "class": "ONT", "sn": "ZTEGC96453C1", "uid": "02:00:c9:64:53:c1", "type": "ZTEGF660" }, { "type": "SML-5051W", "uid": "e4:27:71:62:33:89", "class": "IPTV_STB" }, { "class": "IPTV_STB", "type": "SML-5051W", "uid": "e4:27:71:62:33:a2" } ], "aux_ip_cnt": null, "organization": null, "zip": "...", "apartment": null, "sip_user_1": null, "aux_options": null, "email": "...", "address_key": null, "password": "...", "voip_service_2": null, "sip_pass_1": null, "alt_pn": null, "sip_user_2": null, "voip_no_2": null, "mta_ip": null, "house": "...", "username": null, "phone": "...", "voip_type": null, "voip_service_1": "disconnect", "voip_no_1": null, "last_name": "...", "inet_service": "...", "iptv_service": "...", "unit_id": "581750", "street": "...", "profile_id": null, "first_name": "..." "sid": null, "last_seen": "..." } ] } }}} === PATCH Update subscriber data. ==== URI {{{$Portax::WebPath/rest/subscribers/:sid}}} Expects UTF-8 JSON encoded data in the POST body. ==== FIELDS pn:: New PN unit_id:: New unit ID first_name:: Subscriber's first name last_name:: Subscriber's last_name organization:: Subscriber's organization name house:: Subscriber's house number apartment:: Subscriber's apartment ID street:: Subscriber's street address city:: Subscriber's city name zip:: Subscriber's ZIP code phone:: Subscriber's contact phone number email:: Subscriber's contact email address_key:: UIR or RUIAN address key ID ==== EXAMPLE {{{ curl -s --cert-type P12 --cert $CERT:$PASS -X PATCH \ --data @data.json \ $URL/rest/subscribers/9 }}} {{{data.json}}} {{{ { "email": "new@email.cz" } }}} Response: {{{ { "iptv_service": "disconnect", "aux_options": null, "unit_id": "127", "sip_pass_2": null, "password": "tomiyu233", "voip_no_2": null, "profile_id": null, "street": "Ben Rapid", "devices": [ { "class": "DS_MODEM", "uid": "38:c8:5c:89:97:a0", "type": "EPC3925" } ], "zip": "49460", "voip_no_1": null, "pn": "26", "sip_user_2": null, "house": "0472", "email": "new@email.cz", "apartment": null, "city": "Klockoton", "address_key": null, "username": "Murl", "sip_user_1": null, "mta_ip": null, "inet_service": "TST", "organization": null, "alt_pn": null, "voip_service_2": "disconnect", "sid": 9, "voip_service_1": "disconnect", "voip_type": null, "fixed_ip_cnt": null, "phone": null, "aux_ip_cnt": null, "first_name": "German", "sip_pass_1": null, "last_name": "Schneider" } }}} === DELETE Delete subscriber. Only terminated or disconnected profile can be deleted. ==== URI {{{$Portax::WebPath/rest/subscribers/:sid}}} ==== EXAMPLE {{{ curl -s --cert-type P12 --cert $CERT:$PASS -X DELETE \ $URL/rest/subscribers/9 }}} Response: {{{ {"results":[9],"responseCode":200} }}}