Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 26 Next »


This page will provide you instructions on how to test our API, XTND API, directly and examples on how to communicate with our API.

Test API

If you want to test XTND API, you may use the below Test credentials (Read only). These credentials will allow you to test the "Get" methods in the API Library, meaning you will be able to read data but not create.

 Test credentials (Read only)

Username: APIReadOnly

Password: APIReadOnly

Client parameter for testing: APIDEMO

If you want to test any of the XTND API's with other methods than "Get", please contact your client manager at Extend Commerce or the Extend Commerce Support to get the correct testing credentials.

Extend Commerce use different credentials depending on which method you want to test, so we request that you specify which methods you are interested in.

When you have your testing credentials you may test the different methods in the API interface in the API Library or by making your own API calls.

Fill out the required parameter values, and the optional parameters if they are applicable, and execute by clicking the "Try it out" button. You will be prompted to fill in your credentials to proceed.

 "Try it out" - description

Extend Commerce recommend you to not use the Microsoft Edge browser, since the login-prompt is not fully supported.

Your API response will be showed below the "Try it out" button.

Example Code

Here are some example code on how to communicate with the XTND API.

It´s a c# example, click "c# example" below to view the example. If you want to download the example as a project, click here to download. XTNDAPI.zip

 c# example
using System.Net.Http.Headers;

namespace ExtendAPI
{
    class Program
    {
        static void Main(string[] args)
        {
            string username = "APIReadOnly";
            string password = "APIReadOnly";
            string yourClient = "APIDemo";
            string apiurl = "https://developer.lxir.se/RESTAPI/v1_0/{client}/Products";

            apiurl = apiurl.Replace("{client}", yourClient);
                               
            HttpClient client = new HttpClient();           
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            
            string credentials = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(username + ":" + password));
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credentials );

            
            HttpResponseMessage response = client.GetAsync(apiurl).Result;
            HttpContent content = response.Content;

            // Check Status Code                                
            Console.WriteLine("Response StatusCode: " + (int)response.StatusCode);

            // Read the string.
            string result = content.ReadAsStringAsync().Result;

            // Display the result.
            if (result != null)
            {
                Console.WriteLine(result);
            }
            
            Console.ReadKey();
        }
    }
}





  • No labels