Making your first API call

Connect Enterprise Web Services uses a servlet framework to handle XML API requests. In the data flow diagram, the servlet framework is represented by the API component. The API servlet receives XML requests from clients and returns XML responses from the web application server and the database.

A request to the XML API is formatted as an HTTP request URL that the API servlet handles. A request URL has an action name and parameters in name/value pairs, like this:

https://example.com/api/xml?action=sco-info&sco-id=2006334909

If you have access to an Enterprise Server or Enterprise Hosted account in which you can test API calls, you can experiment. In fact, Adobe recommends testing API calls in the browser while you learn the API and write applications.

Before you begin, it's useful to install a tool that allows you to view HTTP request and response headers in your browser.

Call common-info in a browser

  1. (Optional) Enable a tool for viewing HTTP headers in your browser.
  2. Open a browser and navigate to your Connect Enterprise login page.
  3. Without logging in, delete the part of the URL after the domain name and add a call to common-info:
    https://example.com/api/xml?action=common-info
    

    The response from common-info gives you information about your session with the server, especially the cookie that identifies your session:

    <?xml version="1.0" encoding="utf-8" ?> 
    <results>
        <status code="ok" /> 
        <common locale="en" time-zone-id="85">
            <cookie>breezbryf9ur23mbokzs8</cookie> 
            <date>2006-08-29T19:02:45.843+00:00</date> 
            <host>https://example.com</host> 
            <local-host>abc123def789</local-host> 
            <url>/api/xml?action=common-info</url> 
            <version>breeze_530_r212</version> 
            <user-agent>
                Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 
                .NET CLR 1.1.4322)
            </user-agent> 
        </common>
    </results>
    

    When you log a user in from an application, you need to send the cookie value back to the server to identify the user's session (see "Log in from an application").

Call principal-list in a browser

Once you have the BREEZESESSION cookie value from common-info, the browser adds it to the request header on your next request.

  1. In a web browser, log in to Connect Enterprise. Change the browser URL to call principal-list:
    https://example.com/api/xml?action=principal-list
    
  2. Check the request header. This time it sends the BREEZESESSION cookie value back to the server:
    GET /api/xml?action=principal-list HTTP/1.1
    Accept: */*
    Accept-Language: en-us
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
    Host: example.com
    Connection: Keep-Alive
    Cookie: BREEZESESSION=breezbryf9ur23mbokzs8 
    
  3. Check the response, which lists all principals on the server, each in its own principal element.
    <?xml version="1.0" encoding="utf-8" ?> 
    <results>
        <status code="ok" /> 
        <principal-list>
            <principal principal-id="624526" account-id="624520" type="user"
                    has-children="false" is-primary="false" is-hidden="false">
                <name>joe harrison</name> 
                <login>jharrison@example.com</login> 
                <email>jharrison@example.com</email> 
            </principal>
            <principal principal-id="624550" account-id="624520" type="user"
                    has-children="false" is-primary="false" is-hidden="false">
                <name>bob jones</name> 
                <login>bjones@example.com</login> 
                <email>bjones@example.com</email> 
            </principal>
            ...
        </principal-list>
    </results>
    


Take a survey


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/breeze/6/xml_api/01_usin6.htm