Read Credential Verification Credential Data
GET {{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData
Use the GET {{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData request to return the credential data of the credential from the specified verification of a credential.
|
If a credential has not yet been shared, when |
Prerequisites
Create Credential Verification Session (OPENID4VP), Create Credential Verification Session (NATIVE), or Create Credential Verification Session (NATIVE - Push Notification) to get a credentialVerificationID for the endpoint. Refer also to Credential Verifications.
Example Request
-
cURL
-
C#
-
Go
-
HTTP
-
Java
-
jQuery
-
NodeJS
-
Python
-
PHP
-
Ruby
-
Swift
curl --location --globoff '{{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData' \
--header 'Authorization: Bearer {{accessToken}}'
var options = new RestClientOptions("{{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Get);
request.AddHeader("Authorization", "Bearer {{accessToken}}");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer {{accessToken}}")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
GET /environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData HTTP/1.1
Host: {{apiPath}}
Authorization: Bearer {{accessToken}}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("{{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData")
.method("GET", body)
.addHeader("Authorization", "Bearer {{accessToken}}")
.build();
Response response = client.newCall(request).execute();
var settings = {
"url": "{{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{accessToken}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
var request = require('request');
var options = {
'method': 'GET',
'url': '{{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData',
'headers': {
'Authorization': 'Bearer {{accessToken}}'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
url = "{{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData"
payload = {}
headers = {
'Authorization': 'Bearer {{accessToken}}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'Bearer {{accessToken}}'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
require "uri"
require "net/http"
url = URI("{{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer {{accessToken}}"
response = http.request(request)
puts response.read_body
var request = URLRequest(url: URL(string: "{{apiPath}}/environments/{{envID}}/presentationSessions/{{credentialVerificationID}}/credentialData")!,timeoutInterval: Double.infinity)
request.addValue("Bearer {{accessToken}}", forHTTPHeaderField: "Authorization")
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
Example Response
200 OK
{
"_links": {
"self": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/presentationSessions/31cf41d7-2440-4dd8-b3b0-1bbf3dff135a/credentialData"
}
},
"id": "108b8e45-f5db-4d9c-8c2f-2c4b98abfbc5",
"status": "VERIFICATION_SUCCESSFUL",
"applicationInstance": {
"id": "0a75a85a-f7d1-4d69-91ec-ed0e663989a4"
},
"credentialData": [
{
"type": "VerifiedEmployee",
"types": [
"VerifiedEmployee"
],
"data": [
{
"key": "CardImage",
"value": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 740 480\"><g><rect fill=\"none\" width=\"736\" height=\"476\" stroke=\"#808993\" stroke-width=\"3\" rx=\"10\" ry=\"10\" x=\"2\" y=\"2\"></rect><rect fill=\"#FFFFFF\" height=\"476\" rx=\"10\" ry=\"10\" width=\"736\" x=\"2\" y=\"2\"></rect><image href=\"\" opacity=\"20\" height=\"476\" rx=\"10\" ry=\"10\" width=\"736\" x=\"2\" y=\"2\"></image><text fill=\"#000000\" font-weight=\"450\" font-size=\"30\" x=\"160\" y=\"80\">VerifiedEmployee</text><text fill=\"#000000\" font-size=\"25\" font-weight=\"300\" x=\"160\" y=\"120\">Workplace Credential for interoperability - v2</text><image href=\"\" x=\"42\" y=\"43\" height=\"90px\" width=\"90px\"></image><line xmlns=\"http://www.w3.org/2000/svg\" y2=\"160\" x2=\"695\" y1=\"160\" x1=\"42.5\" stroke=\"#808993\"></line><text fill=\"#000000\" font-weight=\"500\" font-size=\"20\" x=\"190\" y=\"230\">displayName: Gaurav Khot</text><text fill=\"#000000\" font-weight=\"500\" font-size=\"20\" x=\"190\" y=\"272\">givenName: Gaurav</text></g></svg>"
},
{
"key": "displayName",
"value": "John Doe"
},
{
"key": "givenName",
"value": "John"
},
{
"key": "mail",
"value": "johndoe@example.com"
},
{
"key": "surname",
"value": "Doe"
}
],
"issuerId":"9536b3bf-556c-4ed5-a357-5da900ce17d1",
"issuerName": "Issuer Name",
"issuerLogo": "R0lGODlhIAAgAPEAAAAAAAAAM8wzMwAAACH/C05FVFNDQVBFMi4wAwEAAAAh/jpQaW5neSBQaW5neSBQaW5neSBQaW5neQpQSU5HWSBQSU5HWSBQSU5HWSAKUElOR1lQSU5HWVBJTkdZACH5BAkKAAEALAAAAAAgACAAAAKDjI+py+0Po5wSiIuzFtPufx0Z44GbOCbAyrauG2jLS8OxrAo1zd0pYuHpXJyQw0PMsH6Nkgn30D0vK0xE+lwaowHnprVVhEJejbYnTpXNTAR0DWK8p22U1QD/oOzo7vPG1+dwYjAGxbUQJyHodjgYluD4eJdGYSJmqUgRqbnp+QkaUAAAOw=="
}
]
}