SQL Server / Plivo REST API / List all Powerpacks
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
EXEC sp_OASetProperty @http, 'BasicAuth', 1
EXEC sp_OASetProperty @http, 'Login', '{{auth_id}}'
EXEC sp_OASetProperty @http, 'Password', 'password'
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'limit', '<integer>'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'offset', '<integer>'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://api.plivo.com/v1/Account/<auth_id>/Powerpack/', @queryParams
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
RETURN
END
EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
PRINT @iTmp0
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
END
GO
Curl Command
curl -G -d "limit=%3Cinteger%3E"
-d "offset=%3Cinteger%3E"
-u '{{auth_id}}:password'
https://api.plivo.com/v1/Account/<auth_id>/Powerpack/
Postman Collection Item JSON
{
"name": "List all Powerpacks",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Powerpack/?limit=<integer>&offset=<integer>",
"protocol": "https",
"host": [
"api",
"plivo",
"com"
],
"path": [
"v1",
"Account",
"{{auth_id}}",
"Powerpack",
""
],
"query": [
{
"key": "limit",
"value": "<integer>",
"description": "Used to display the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20."
},
{
"key": "offset",
"value": "<integer>",
"description": "Denotes the number of value items by which the results should be offset"
}
]
},
"description": "This API can be used to fetch a list of Powerpacks, below is the list of arguments that can be passed in this API request, more information can be found [here](https://www.plivo.com/docs/sms/api/powerpack#list-all-powerpacks)\n\n| Arguments | Description | Required/Conditional/Optional |\n| :--- | :----: | ---: |\n| limit | Used to display the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20. | Optional |\n| offset |Denotes the number of value items by which the results should be offset. Defaults to 0 | Optional |"
},
"response": [
{
"name": "List all Powerpacks",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Powerpack/?limit=<integer>&offset=<integer>",
"protocol": "https",
"host": [
"api",
"plivo",
"com"
],
"path": [
"v1",
"Account",
"{{auth_id}}",
"Powerpack",
""
],
"query": [
{
"key": "limit",
"value": "<integer>",
"description": "Used to display the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20."
},
{
"key": "offset",
"value": "<integer>",
"description": "Denotes the number of value items by which the results should be offset"
}
]
}
},
"code": 200,
"_postman_previewlanguage": "json",
"header": [
],
"cookie": [
],
"body": "{\n \"api_id\": \"e44c159e-0a02-11ea-b072-0242ac110007\",\n \"meta\": {\n \"limit\": 20,\n \"next\": \"/api/v1/account/xxxxxxx/Powerpack?offset=20&limit=20\",\n \"offset\": 0,\n \"total_count\": 53\n },\n \"objects\": [\n {\n \"application_id\": \"\",\n \"application_type\": \"\",\n \"created_on\": \"2019-10-09T11:10:59.666461Z\",\n \"local_connect\": true,\n \"name\": \"test\",\n \"number_pool\": \"/v1/Account/xxxxxxxxx/NumberPool/<number_pool_uuid>/\",\n \"sticky_sender\": true,\n \"uuid\": \"<powerpack_uuid>\"\n },\n {\n \"application_id\": \"\",\n \"application_type\": \"\",\n \"created_on\": \"2019-10-09T17:03:31.837944Z\",\n \"local_connect\": false,\n \"name\": \"p23\",\n \"number_pool\": \"/v1/Account/xxxxxxxx/NumberPool/<number_pool_uuid>/\",\n \"sticky_sender\": false,\n \"uuid\": \"<powerpack_uuid>\"\n },\n {\n \"application_id\": \"\",\n \"application_type\": \"\",\n \"created_on\": \"2019-10-09T16:54:34.0117Z\",\n \"local_connect\": false,\n \"name\": \"p22\",\n \"number_pool\": \"/v1/Account/xxxxxxxx/NumberPool/<number_pool_uuid>/\",\n \"sticky_sender\": false,\n \"uuid\": \"<powerpack_uuid>\"\n }\n}"
}
]
}