SQL Server / Plivo REST API / Retrieve a PHLO
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, 'phlo_id', '<PHLO_ID>'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://phlorunner.plivo.com/v1/phlo/{phlo_id}', @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 "phlo_id=%3CPHLO_ID%3E"
-u '{{auth_id}}:password'
https://phlorunner.plivo.com/v1/phlo/{phlo_id}
Postman Collection Item JSON
{
"name": "Retrieve a PHLO",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "https://phlorunner.plivo.com/v1/phlo/{phlo_id}?phlo_id=<PHLO_ID>",
"protocol": "https",
"host": [
"phlorunner",
"plivo",
"com"
],
"path": [
"v1",
"phlo",
"{phlo_id}"
],
"query": [
{
"key": "phlo_id",
"value": "<PHLO_ID>",
"description": "Unique identifier for the PHLO. PHLO ID is available on your\nconsole."
}
]
},
"description": "More information can be found [here](https://www.plivo.com/docs/phlo/api/phlo#retrieve-a-phlo)"
},
"response": [
{
"name": "Retrieve a PHLO",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "https://phlorunner.plivo.com/v1/phlo/{phlo_id}?phlo_id=<PHLO_ID>",
"protocol": "https",
"host": [
"phlorunner",
"plivo",
"com"
],
"path": [
"v1",
"phlo",
"{phlo_id}"
],
"query": [
{
"key": "phlo_id",
"value": "<PHLO_ID>",
"description": "Unique identifier for the PHLO. PHLO ID is available on your\nconsole."
}
]
}
},
"code": 200,
"_postman_previewlanguage": "json",
"header": [
],
"cookie": [
],
"body": "{\n \"api_id\": \"e4202a42-0419-43db-9889-c440d3167796\",\n \"phlo_id\": \"4c1a9f23-7f56-4879-bb80-db856e1e7701\",\n \"name\": \"SMS Notifications\",\n \"created_on\": \"2019-01-30 09:20:08.617883+00:00\"\n}"
}
]
}