Skip to main content
All CollectionsService Announcements
How do I test my API integration to verify support for TLS 1.1/1.2?
How do I test my API integration to verify support for TLS 1.1/1.2?

This article has code snippets to test for TLS 1.1/1.2 support in your codebase.

Samantha avatar
Written by Samantha
Updated over a week ago

Please be advised that starting on March 1, 2018, Friendbuy will be deprecating support for TLS version 1.0.  If you are still using TLS version 1.0, you will need to upgrade to 1.1 or 1.2 prior to March 1st to ensure that requests to our platform continue to function.

How do I know if this impacts us?

  • This change only affects Friendbuy's REST API. If you are not integrated with our API, no further action is required.

  • If you are using Friendbuy's REST API, check with your IT team to see if the version of TLS supported by your servers and systems is 1.1. or greater.  If the answer is "yes," you are all set.

  • If you are not sure or the answer is "no," please follow the below steps.

For the verification purposes, we have set up this endpoint address:
​ https://api-tls11.friendbuy.com

Please note that this endpoint is only meant to be used for testing a TLS connection. It will be disabled after the cutover date and should not be used in production code.

Below are examples of test snippets of code in several languages. To test, run the appropriate code snippet in your production environment.

Important: These examples may use libraries that differ from your production code, e.g. the Python snippet uses the requests library to make the request. If your codebase uses a different library than the example, you will need to test with the library used in your codebase.

If you receive the response  {"greeting": "This is the Friendbuy API"} then you are all set and no further action will be needed. If the request throws an error, then you will need to upgrade your environment to support TLS 1.1.

Python

import requests
from requests.exceptions import ConnectionError

try:
    r = requests.get('https://api-tls11.friendbuy.com')
    print(r.json())
except ConnectionError as e:
    print('TLS 1.1 is not supported. Please upgrade your integration.')


NodeJS

const request = require("request");

request('https://api-tls11.friendbuy.com', (error, response, body) => {
  if (error) {
    console.log('TLS 1.1 is not supported. Please upgrade your integration.');
    return;
  }
  console.log(body);
});

PHP

<?php
$curl = curl_init();

$url = "https://api-tls11.friendbuy.com";

curl_setopt($curl, CURLOPT_SSLVERSION, 1.0);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($curl);
echo $result;

curl_close($curl);
?>


Java

import java.net.*;
import java.io.*;

class URLConnectionReader {
    public static void main(String[] args) throws Exception {
        URL testApi = new URL("https://api-tls11.friendbuy.com");
        try {
            URLConnection conn = testApi.openConnection();
            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String inputLine;

            while ((inputLine = in.readLine()) != null)
                System.out.println(inputLine);
            in.close();
        } catch(Exception e) {
            System.out.println(e.getMessage());
            System.out.println("TLS 1.1 is not supported. Please upgrade your integration.");
        }
    }
}


Go
All versions of Go already support TLS 1.2, so you will not need to make any changes.


.NET

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

public class TestFriendbuyApi
{
    public static void Main ()
    {
        WebRequest request = WebRequest.Create("https://api-tls11.friendbuy.com");
        request.Credentials = CredentialCache.DefaultCredentials;
        try {
            WebResponse response = request.GetResponse();
            Console.WriteLine(((HttpWebResponse)response).StatusDescription);
            Stream dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);
            string responseFromServer = reader.ReadToEnd();
            Console.WriteLine(responseFromServer);
            reader.Close();
            response.Close();
        } catch (WebException e) {
            Console.WriteLine(String.Concat(e.Message, e.StackTrace));
        }
    }
}

Ruby

require "net/http"

uri = URI.parse('https://api-tls11.friendbuy.com')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

begin
    request = Net::HTTP::Get.new(uri.request_uri)
    response = http.request(request)
    puts response.body
rescue Errno::ECONNRESET => e
    puts "TLS 1.1 is not supported. Please upgrade your integration."
end


For questions or additional assistance, please contact us at support@friendbuy.com.

Did this answer your question?