Latest Legacy

Retrieve a session

Retrieves a session.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/Verify/Session/{session_uuid}/

Arguments

No arguments need to be passed.

Returns

This API call returns the details for the session identified by the session_uuid specified in the request URL.

Response

{
    "api_id": "abf7fc2b-fac5-471c-9592-74ed6834b5e6",
    "session_uuid": "60ea68db-b123-46d9-9eb2-1201d516dbbd",
    "app_uuid": "ec66515e-86f6-4507-8620-31c039538d7a",
    "recipient": "919380013443",
    "channel": "voice",
    "status": "Expired",
    "count": 3,
    "attempt_details": [
        {
            "channel": "voice",
            "attempt_uuid": "90cc6cde-db80-4d14-9716-3aaa2b403377",
            "status": "answer",
            "time": "2023-06-01T08:52:39.363253Z"
        },
        {
            "channel": "sms",
            "attempt_uuid": "acbffc94-283b-42b3-8a96-65cbc18a9624",
            "status": "delivered",
            "time": "2023-06-01T08:52:59.484375Z"
        },
        {
            "channel": "voice",
            "attempt_uuid": "04a81620-c4ab-45d6-847d-cc3ae6fec121",
            "status": "early media",
            "time": "2023-06-01T08:53:25.577153Z"
        }
    ],
    "charges": {
        "total_charge": "0.113",
        "validation_charge": "0.0000",
        "attempt_charges": [
            {
                "attempt_uuid": "90cc6cde-db80-4d14-9716-3aaa2b403377",
                "channel": "voice",
                "charge": "0.03300"
            },
            {
                "attempt_uuid": "acbffc94-283b-42b3-8a96-65cbc18a9624",
                "channel": "sms",
                "charge": "0.08000"
            },
            {
                "attempt_uuid": "04a81620-c4ab-45d6-847d-cc3ae6fec121",
                "channel": "voice",
                "charge": "0.00000"
            }
        ]
    },
    "created_at": "2023-06-01T08:52:39.363253Z",
    "updated_at": "2023-06-01T08:53:25.577153Z"
}

Example Request

1
2
3
4
5
6
7
8
9
import sys
sys.path.append("../plivo-python")
import plivo

client = plivo.RestClient()

response = client.verify_session.get('<session uuid>')

print(response)
1
2
3
4
5
6
7
8
9
10
11
12
require "rubygems"
require "/usr/src/app/lib/plivo.rb"
include Plivo
#Environment
api = RestClient.new("<auth_id>", "<auth_token>")
begin
     puts("Get Session")
     response = api.verify_session.get('<session_uuid>')      
     puts response
rescue PlivoRESTError => e
     puts 'Exception: ' + e.message
end
1
2
3
4
5
6
let plivo = require('plivo')
let client = new plivo.Client('<auth_id>', '<auth_token>');
client.verify_session.get('<session_uuid>').then(function(response) {
let formattedResponse = JSON.stringify(response, null, 2);
console.log(formattedResponse);
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
require '/usr/src/app/vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoResponseException;

// ENVIRONMENT
$client = new RestClient("<auth_id>", "<auth_token>");

// Get a particular session detail
try {
$response = $client->verifySessions->get('<session_uuid>');
print_r($response);
}
catch (Exception $ex) {
print_r($ex);
}
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.verify_session.VerifySession;
import com.plivo.api.models.verify_session.SessionCreateResponse;
import com.plivo.api.models.message.Message;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.base.ListResponse;
class Session {
    public static void main(String[] args) throws PlivoValidationException {
      Plivo.init("<auth_id>", "<auth_token>");
      // Get Session
      try {
        VerifySession response = VerifySession.getter("<session_uuid>").get();
        System.out.println(response);
      } catch (PlivoRestException | IOException e) {
        e.printStackTrace();
      }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;
namespace dotnet_sdk
{
    class Session
    {
        static void Main(string[] args)
        {
            //ENVIRONMENT
            var api = new PlivoApi("<auth_id>", "<auth_token>"); 
            //Get Session
             try
             {   
                Console.WriteLine("Get Session Details");
                var response = api.VerifySession.Get("<session_uuid");
                Console.WriteLine(response);
             }
catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

}
}
}
1
2
curl -i --user auth_id:auth_token \
    https://api.plivo.com/v1/Account/{auth_id}/Verify/Session/{session_uuid}/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import (
"fmt"
"encoding/json"

"github.com/plivo/plivo-go"
)

func main() {
client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
if err != nil {
fmt.Printf("Error:\n", err)
}
//Get the details of a session
response_get, err := client.VerifySession.Get(response.SessionUUID)
if err != nil {
fmt.Print("Error", err.Error())
return
}
res1, _ := json.Marshal(response_get)
fmt.Printf("Response: \n\n %#v \n", string(res1))
}