1. Introduction
  2. Order Management
  3. Sample Code
  4. Errors and Troubleshooting
  5. Appendix
  6. Print-Friendly Documentation

Sample Code - Retrieve Certificate

For the examples below:

Account ID
001007
API Key
n9hq0fp9q63htpmt7xcthztt5n4zx721
Order ID
111222
GET requests are very simple. After authenticating with the service, having the client library access the URL is all that is required.

Using cURL

curl -u "001007:n9hq0fp9q63htpmt7xcthztt5n4zx721" \
-H "Accept: application/vnd.digicert.rest-v1+json" \
https://api.digicert.com/order/111222/certificate

Using C#

using System;
using System.Text;
using System.Net;
using System.IO;

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      string uri = "https://api.digicert.com/order/111222/certificate";

      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
      request.KeepAlive = false;
      request.ProtocolVersion = HttpVersion.Version10;
      request.Method = "GET";
      request.UserAgent = "DigiCertAPIClient/0.1";
      request.ContentType = "application/vnd.digicert.rest-v1+json";
      request.Headers.Add("Authorization", "Basic " + GetEncodedCredential());

      try
      {
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();//throws WebException
        Console.WriteLine(new StreamReader(response.GetResponseStream()).ReadToEnd());
      }
      catch (WebException e)
      {
        Console.WriteLine(e.Message);
      }
    }

    static private String GetEncodedCredential()
    {
      return Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes("001007" + ":" + "n9hq0fp9q63htpmt7xcthztt5n4zx721"));
    }
  }
}

Using PHP

$url = 'https://api.digicert.com/order/111222/certificate';

$headers = array(
  'Accept: application/vnd.digicert.rest-v1+json',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, '001007:n9hq0fp9q63htpmt7xcthztt5n4zx721');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

Using Ruby

require 'net/http'
require 'uri'

uri = URI.parse 'https://api.digicert.com/order/111222/certificate'

request = Net::HTTP::Get.new uri.request_uri
request.basic_auth('001007','n9hq0fp9q63htpmt7xcthztt5n4zx721')

request['Accept'] = 'application/vnd.digicert.rest-v1+json'

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

result = http.request request