Getting Started with the Knowledge Services

Get started with our Knowledge Services here. Learn about our authentication, environment and response codes. Follow a step by step process in order to learn how to use our services.

Clone a Code Sample

After you explore our service reference and use our interactive documentation, you can clone one of our code samples to get you started. Our service reference contains a code sample for each resource in four different languages. Whatever language that you are using, you can use our Python code sample below as a model and tweak the parameters to get your desired request.

In the following code sample, we create a code sample for the HoldingsIQ service. We retrieve vendor details from EPKB for a specific vendor ID using the sandbox environment. The process of creating the code sample for the resource is described below. For this particular example, we used windows and installed Python 3.6.0 prior to creating the sample.

Note: If you need to look up the URL or parameters for a resource, refer back to the service reference or interactive documentation.

To Create a Code Sample:

  1. Note the request URL for your desired resource.

    Request URL

    https://sandbox.ebsco.io/rm/rmaccounts/{custid}/vendors/{vendorid}
  2. Determine the parameters that you would like to use for your request.

    Parameters

    vendorid = {Your desired vendor id}
    custid = {EBSCO provided customer id}
    x-api-key = {EBSCO provided API key}
  3. Create a new sample.py file for your sample code.
  4. Add the following code to sample.py. The code below defines your parameters, forms the request URL, forms the request headers, sends the request and gets the response back.
    
    # File: sample.py
     
    # HTTP Library
    import http.client
     
    # Parameters
    DUMMYCUSTID = {EBSCO provided customer ID}
    DUMMYVENDORID = {your desired vendor ID}
    DUMMYAPIKEY = {EBSCO provided API key}
     
    # Form the URL
    url = ''.join(['/rm','/rmaccounts/', DUMMYCUSTID, '/vendors/', DUMMYVENDORID])
     
    # Create Connection Instance
    conn = http.client.HTTPSConnection("sandbox.ebsco.io")
     
    # Create the Request Headers
    headers = {
        'accept': "application/json",
        'x-api-key': DUMMYAPIKEY
        }
     
    # Send Request 
    conn.request("GET", url, headers=headers)
     
    # Get Response
    res = conn.getresponse()
    data = res.read()
     
     
    print(data.decode("utf-8"))  
    
  5. Change {EBSCO provided customer ID}, {your desired vendor ID} and {EBSCO provided API key} in the sample.py script to the parameters that you gathered in Step 2.

    Note: If you would like to use a different resource, you will need to form the URL in the code to match the resource. Also, you will need to take into account the parameters for the new resource. Refer to our code samples in our service reference for additional guidance.
  6. Save your sample.py file.
  7. Run your script by entering python samply.py in a Command Prompt. If successful, a JSON response with the requested vendor details will be returned and displayed on the screen.
    { 
      "isCustomer": false,
      "packagesSelected": 60,
      "packagesTotal": 645,
      "vendorId": 19,
      "vendorName": "EBSCO",
      "proxy": {
        "id": "",
        "inherited": false
      },
      "vendorToken": null
    } 
    

You have completed your first code sample consuming HoldingsIQ. You are on your way. Have fun!