Previous Topic: URL ConstructionNext Topic: BFC API Examples


BFC API Authentication

This section contains the following topics:

Create a Session

End a Session

Before you can use the BFC APIs, you must create an authentication session. You create a session by posting a username and password to the login resource for the desired BFC API version. If the username and password are valid, a session id is returned which must be passed for each BFC API call in the Authorization header. Sessions remain valid for 30 minutes without activity. Each request to the BFC will reset the session timeout unless the header X-CA-FC-runningClock is included and has a value of true. This is useful for clients with unattended polling calls to the BFC. A client can terminate a session by posting the session id to the logout resource.

Create a Session

POST  BFC/1.1/login
Headers

Content-Type:application/json

Arguments

The payload is a JSON object with two fields: username and password.

username

If the username is not tenant-qualified, the core tenant is assumed. Currently, the only tenant available in the BFC is the core tenant.

Example: joe (or core/joe)

password

The password for the user.

Example: MyPassword

{"username":"joe","password":"MyPassword"}
Results

Returns a JSON string representing the session id, such as 2f9b84766cdacd376125c7d57aaf6aa7.

Python Example

from httplib import HTTPSConnection
import json
import os
import sys
bfcHost = os.environ["BFC_HOST"]
conn = HTTPSConnection(bfcHost + ':8443')
conn.connect()
conn.request(method='POST', url='/BFC/1.1/login',
             body='{"username":"joe","password":"MyPassword"}',
             headers={'Content-Type':'application/json'})
bfcSession = json.loads(conn.getresponse().read())
print "BFC_SESSION={0}".format(bfcSession)

End a Session

POST/BFC//logout 
Headers

Content-Type:application/json

Authorization:your session id

Arguments

Your session id