PingOne Platform APIs

Read One Credential Issuer DID Document (custom domain)

   

GET {{customDomain}}/.well-known/did.json

Use the GET {{customDomain}}/.well-known/did.json request to return the credential issuer Decentralized Identifiers (DID) document using the specified custom domain.

Prerequisites

The variable {{customDomain}} must be defined as the Custom Domain configured for the environment.

Example Request

  • cURL

  • C#

  • Go

  • HTTP

  • Java

  • jQuery

  • NodeJS

  • Python

  • PHP

  • Ruby

  • Swift

curl --location --globoff '{{customDomain}}/.well-known/did.json'
var options = new RestClientOptions("{{customDomain}}/.well-known/did.json")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Get);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {

  url := "{{customDomain}}/.well-known/did.json"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  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 /.well-known/did.json HTTP/1.1
Host: {{customDomain}}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("{{customDomain}}/.well-known/did.json")
  .method("GET", body)
  .build();
Response response = client.newCall(request).execute();
var settings = {
  "url": "{{customDomain}}/.well-known/did.json",
  "method": "GET",
  "timeout": 0,
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
var request = require('request');
var options = {
  'method': 'GET',
  'url': '{{customDomain}}/.well-known/did.json',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "{{customDomain}}/.well-known/did.json"

payload = {}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{customDomain}}/.well-known/did.json');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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("{{customDomain}}/.well-known/did.json")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var request = URLRequest(url: URL(string: "{{customDomain}}/.well-known/did.json")!,timeoutInterval: Double.infinity)
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

{
    "@context": [
        "https://www.w3.org/ns/did/v1"
    ],
    "id": "did:web:issuer.customerdomain.com",
    "verificationMethod": [
        {
            "id": "#a1db5eb2-80c9-4f47-bec9-18769e844514",
            "type": "JsonWebKey2020",
            "controller": "did:web:issuer.customerdomain.com",
            "publicKeyJwk": {
                "crv": "P-256",
                "kty": "EC",
                "x": "YaKp5ojWclXToMR4kTS9-HckrcodO3FY-VBAlhlYdMc",
                "y": "nvQmMj_lzj3KSZG03cpHXePA6tmIPr2tzKkJWN70iMg"
            }
        }
    ],
    "authentication": [
        "did:web:issuer.customerdomain.com#a1db5eb2-80c9-4f47-bec9-18769e844514"
    ],
    "assertionMethod": [
        "did:web:issuer.customerdomain.com#a1db5eb2-80c9-4f47-bec9-18769e844514"
    ]
}