Logging into the new API v4.0

This past week, Bronto was proud to introduce many new features in accordance with our Spring 2010 Release. The release also included a new version of the API (version 4). While the old API (legacy version 3) is not going away, the new version is the one Bronto will be concentrating on and developing new features for. The new API will give you access to more Bronto objects and improved filtering of those objects. Along with the improvements made in the new API are a few changes. One of the main changes is how you authenticate or log into the API. You are no longer required to create an API user with the appropriate permissions. Instead, you will create an API token. Once you have been authenticated, you will be returned a sessionId that you will use for the rest of you session.

Creating a token

To create a token, go to Home->Settings->Data Exchange and click Add Access Token. The token can be limited in the actions it can perform, such as read, write, or send. Hence, you can configure each token you create and allow it do any one of those actions, a combination, or all of them.
 
 

Some Example Code (PHP and JAVA AXIS)

Below is some example code you can use to get an idea of how to login to the new API.

PHP

/* This example script will connect to the API and authenticate a session. Be sure to replace the "ADD YOUR API TOKEN HERE" text with a working API Token. */ ini_set("soap.wsdl_cache_enabled", "0"); date_default_timezone_set('America/New_York'); $wsdl = "https://api.bronto.com/v4?wsdl"; $url = "https://api.bronto.com/v4"; $client = new SoapClient($wsdl, array('trace' => 1, 'encoding' => 'UTF-8')); $client->__setLocation($url); $token = "ADD YOUR API TOKEN HERE"; $sessionId = $client->login(array("apiToken" => $token))->return; $client->__setSoapHeaders(array(new SoapHeader("https://api.bronto.com", 'sessionId', $sessionId)));

JAVA AXIS

/** * This example program will connect to the API and authenticate a session. */ package com.bronto; import org.apache.axis.client.Stub; import com.bronto.api.objects.BrontoSoapApi; import com.bronto.api.objects.BrontoSoapApiImplService; import com.bronto.api.objects.BrontoSoapApiImplServiceLocator; import com.bronto.api.objects.StringValue; public class TestLoginBronto { private static final String API_TOKEN = "ADD YOUR API TOKEN HERE"; public static void main(String args[]) throws Exception { BrontoSoapApiImplService locator = new BrontoSoapApiImplServiceLocator(); BrontoSoapApi api = locator.getBrontoSoapApiImplPort(); // Login String sessionId = api.login(API_TOKEN); if (sessionId == null) { System.out.println("Login failed."); return; } ((Stub)api).setHeader(locator.getServiceName().getNamespaceURI(), "sessionId", sessionId); System.out.println("Login was successful."); } }

Lots More

With its expanded functionality and improved design, the new API provides many exciting opportunities to integrate with your systems outside of Bronto. We hope you enjoy the new API as much as we enjoy bringing it to you.

Andrew Kanes
Support Engineer at Bronto

 

Comments

Using the New readContacts Function

[...] the past few weeks, we

[...] the past few weeks, we have looked at how to login to the new API and how to filter result sets. Now we are going to take a closer look at how to work [...]
Using The apiToken Functions In Version 4

[...] or an entire agency. Of

[...] or an entire agency. Of course, after you create the API Token, you are now able to use it to log into the API. We hope you find this new functionality useful and please let us know if you have any [...]

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

More information about formatting options

CAPTCHA
Just checking to see if you're a human visitor. We don't like automated spam submissions.