Skip to main content

API Developers Forum

We're thrilled to see all the great development going on with the NationBuilder API, and want to open this forum up for public feedback, helps and hints, questions and more. This resource is curated by the NationBuilder API Team - our goal is developers helping developers, so we definitely want to hear from you. You can also use the tags to rank posts. Thanks!

Please check your e-mail for a link to activate your account.
Sort by

People API Membership Creation

I've used the People API to sync members between another system and NB but the API doesn't appear to set memberships on the new person record.  Even with membership_level_name set no corresponding membership record is created for that person.

Furthermore no error is given if a non-existent membership type is specified.  Is the people API not capable of creating memberships, am I doing it wrong, or has something changed?

3 reactions

People API Should Expose "Bad Email Address" field

Like the title says, the boolean flag for the "bad email address" exposed in the HTML UI should be available in the Person record returned. Is there another way to acquire and set this value ?

completed

Update: This field was added to the People API on March 25. Thanks for your suggestion!

Official response from

3 reactions

People API Update endpoint always errors

I'm using the Update endpoint, with the request straight from the documentation:

curl 'https://[nation].nationbuilder.com/api/v1/people/[id]?access_token=[token]' -X PUT -H 'Content-Type: application/json' -d '{"person":{"first_name":"Joe","email":"[email protected]","phone":"303-555-0841"}}'

I receive this response:

{"code":"server_error","message":"You have encountered a server error."}

This is after creating a record using the People Create endpoint, and verifying the record is available with the People Show endpoint.

Any help appreciated.

1 reaction

People Create Endpoint and PHP.

Hello, I am trying to create an application with People Create Endpoint and the PHP API.
'Get Peoples' works perfect but when I try to add a new person in my Nation, the problems begin.
My token is valid, because I tested it with the new API Explorer tool.
My example with GET is:
$ token = ' MyToken ';
$ client -> setAccessToken ($ token );
$ response = $ client -> fetch ( $ baseApiUrl '/ api/v1/people /'. )
print_r ( $ response );

This shows all the Peoples in my nation.
And this is the example I'm using with POST:
$ token = ' MyToken ';
$ client -> setAccessToken ($ token );
/ *
$ data = array (
    'person ' = > array (
        'email' = > ' [email protected] ' , " last_name " = > " Smith ", " first_name " = > "Bob"
    )
) ;
$ data_string = json_encode ( $ data );
$ response = $ client -> fetch ( $ baseApiUrl '/ api/v1/people / ', $ data_string , "POST" . )
print_r ( $ response );
I'm not getting any response neither in the browser nor in the curl_request_info file.
What is wrong with my code?
I'm using Ryan Morgan's library ( https://github.com/RyanMorgan/PHP-OAuth2 ) .
I hope someone can help me or show me one example of how to do a POST Request for People correctly?
Thank you very much!
7 reactions

People Create Endpoint documentation

The documentation, and API spec both list address3 as a field, however it doesn't seem to display on the front-end. I suspect the field was deprecated on the front-end but maintained in the external API for posterity. Also, the People documentation lists primary address as an attached resource, however it's not recorded as a read-only resource. I haven't had a deep look into the People API yet, but I'm fairly certain there will be other similar resources and attributes attached.

completed

Hi Jeremy,

You are correct about the address 3 field. Most address formats use Address 1, Address 2 and then City and State.

The primary address is set from the other addresses, so you can't write directly to it. You can read how the primary address is determined here - https://nationbuilder.com/edit_primary_address#automatic

Official response from

2 reactions

People Credentials

Hello I'm wondering if there is a way to use the people credentials from a nation into my application. 
I mean, is it possible that people from my nation logs in my app with their nationbuilder credentials (user and password)? 
I saw an app called oneclickpolitics which ensures that "NationBuilder customers can very Quickly and Securely login using their NationBuilder accounts." 
How can I do that? Am I missing some functionality from the nationbuilder API? As far as I know, the people endpoint returns no credentials. 
I would really appreciate any suggestions or help.
Thank you!
6 reactions

People -> Donations Relationship

People -> Donations is a one-to-many relationship, but there doesn't appear to be a way to get donations in this method. I haven't been able to find a Donations attribute on a Person (either full or restricted), there doesn't appear to be a Donations resource endpoint which allows searching by Donor ID, and the Donations search endpoint also doesn't allow Donor ID. Is there a way to get Donations from a single Person without getting all the Donations from the API, then filtering them after-the-fact?

1 reaction

People Search Api not showing results

 

hi,

I am new to using the nation builder api. I have added multiple contacts to my account and trying to search on them using various fields. But I am unable to get the results.

The following person exists in my contacts and i can get it when I use first_name and last_name in the search parameters, but If i use city or state i am unable to get results.

https://slugName.nationbuilder.com/api/v1/people/search?first_name=Jennifer&last_name=Rolle

primary_address: {

address1: "address"
address2: "3"
address3: null
city: "Fort Lauderdale"
state: "FL"
country_code: "US"
zip: "33311"
}
but if i use https://slugName.nationbuilder.com/api/v1/people/search?state=FL
i get no results
{
results: [0]
next: null
prev: null
}

 

completed

Hi Ella,

There was an issue with people#search where instead of searching the primary address, the home address of people was searched instead (people in NationBuilder can have up to 7 different addresses, more on that here - including how to set primary address for a person). This explains why you weren't seeing results through the API as your nation didn't have any home addresses that matched what you were searching for.

A fix was pushed out today, and searching city or state through people#search should now return results that match based on the primary addresses of folks in your nation.

Best,

Alex

Official response from

5 reactions

People/search endpoint only returns exact matches

When I hit the search endpoint for a name, for example, I have to use the exact name to return a result. For example, if I search for first_name=brad it won't return results for 'Bradley'. 

In addition, searching for names of organizations doesn't return results at all.

considering

This issue has been confirmed but does not have a set timeline on when it will be fixed. Please follow this cards if you would like to receive email updates about the status of this issue.

Official response from

12 reactions

People Search Endpoint - Updated since

What format is the "date" used in searches on the updated_since field in the people search endpont?

What is the granularity of the comparison, is it just a comparison of the date or is it really a combarison with the updated_at field of the record, which appears to have a resolution of 1s?

An example of using this api call might be useful.

1 reaction

People Update server error

I'm trying to update a supporter record and running in to a 500 error.

I did a PUT request to
https://[nation].nationbuilder.com/api/v1/people/[id]?access_token=[token]
using the data:
{"person":{"first_name":"Jane","last_name":"Smith","phone":"123-456-7890"}}

This is the response:
HTTP/1.1 500 Internal Server Error
Date: Wed, 09 Apr 2014 14:38:59 GMT
Server: Apache/2.2.22 (Ubuntu)
X-UA-Compatible: IE=Edge,chrome=1
Cache-Control: no-cache
Nation-RateLimit-Limit: 15000
Nation-RateLimit-Remaining: 14978
Nation-RateLimit-Reset: 1397088000
X-Request-Id: 61ca028a58830a98d0c83ce60c18d079
X-Runtime: 0.532239
X-Rack-Cache: invalidate, pass
X-Powered-By: Phusion Passenger 4.0.23
Status: 500 Internal Server Error
Vary: Accept-Encoding
Content-Type: application/json
Via: 1.1 nationbuilder.com
Connection: close
Transfer-Encoding: chunked
{"code":"server_error","message":"You have encountered a server error.","inner_error":{"name":"NoMethodError","message":"undefined method `strip' for nil:NilClass"}}

 

The same data POSTed to the create endpoint successfully created a supporter, and I'm using the same function to PUT tags.

Any ideas what could be causing this?

1 reaction

Permissions on API

I would like to be able to do more with the API than just searches, such as creating and updating people. Currently this is possible with the test token, but not an OAuth token.

A global permission level for the API would be enough, along with a flag on users to specify if they can OAuth and use the API's extended permissions. That way I could grant fine-grained permissions to the API, then give just a few users access to the API through OAuth. I would really like to stop using the test token because that's terrible security long-term.

completed

Grigory,

You can limit access to staffers by toggling their permission set. If you navigate through the control panel to Settings > Permission sets > select the permission set you want to limit authentication for > and scroll to the bottom you will see the option under API. Toggle this to 'no' and then assign that permission set to staffers you want to limit app authentication for.

 

Official response from

1 reaction

personal transaction history

How can I get person specific transaction history? Complete records a person has in Nationbuilder with timestamp?

2 reactions

Person API "created_at

For the PUSH endpoint of the PERSON api, will updated persons have the "created_at" property overwritten with the time that the update took place -- the same value also appearing in "updated_at"?  (for whatever reasons, this is the case in the API docs

completed

Hey Lilia,

The people#push endpoint allows you to update or create a person in your nation. When the request creates a person, the two fields you mentioned (created_at and updated_at) will be the same. In other cases where the request matches an existing person in your nation, the updated_at field will change (along with the other data passed in the request) on the person's profile.

I hope this helps clear things up!

Official response from

2 reactions

Person could_vote_status values are Inconsistent with On-line Documentation

The documentation of "Person Resource" at <http://nationbuilder.com/people_api> says

could_vote_status - boolean indicating if this person could vote in an election or not, derived from their election-related IDs

However, the examples, and, actual, server responses contain values null, -1,  1.

This seems to be a nullable integer. Trying to parse it as a boolean can cause your application to fail.

What are the possible values, and their meanings for this field?

Thanks,

Pav

2 reactions

'phone' resource is blank when using people/show endpoint

I'm looking at a record in my nation that contains a phone number but when I use people/show endpoint the 'phone' resource is null. 'phone_normalized' does contain the number, however.

Add your reaction

php

2 reactions

PHP Failing to work...

Very descriptive, I know. But after running through the PHP quickstart http://nationbuilder.com/api_documentation  I get so far as obtaining the code, but when trying to get an access token it returns a 400 bad request error with the message: "Your browser sent a request that this server could not understand."

This is all code provided by nationbuilder, so what went wrong? Is there anything I need to know before starting? I set up an app. It is set to public. It currently says "in review" for status but I see no mention of this mattering in the docs. 

This is the code:

require('src/OAuth2/Client.php');
require('src/OAuth2/GrantType/IGrantType.php');
require('src/OAuth2/GrantType/AuthorizationCode.php');


$client_id = 'xxxxxx'; //obviously i use the real id and key
$key = 'xxxxxx';

$client = new OAuth2\Client($client_id, $key);

$redirectUrl = 'http://www.some-site.com/oauth.php';

$authorizeUrl = 'https://xxx.nationbuilder.com/oauth/authorize';
/*

running this gives the code below.
$authUrl = $client->getAuthenticationUrl($authorizeUrl, $redirectUrl);

echo $authUrl;

*/
$code = 'xxxxxx';

$accessTokenUrl = 'https://xxx.nationbuilder.com/oauth/token';
$params = array('code' => $code, 'redirect_uri' => $redirectUrl);
$response = $client->getAccessToken($accessTokenUrl, 'authorization_code', $params);
$token = $response['result']['access_token'];
print_r($response);

 

Did I miss something? Or does someone have a more complete example to try?

3 reactions

PHP vs. C++

The folks who are building our store and automation are redoing some of the programing they did  in PHP in C++  because it runs faster and can handle a lot more data.  Would doing that help with the speed of loading into your system?  I don't know how it is programed now, but thought I'd pass that along.

completed

Generally speaking, performance of API access is mostly limited by network connectivity and I/O time so it’s unlikely that you will see a major performance difference accessing our APIs using PHP or C++.

Official response from

2 reactions

PHP Webhook Listener

Make a php file on your server and create a webhook to point to it. When data is sent to the page, it will send you an email with the data. Make sure to change the email address before using.

 

<?php
$data = file_get_contents('php://input');
$json_data = json_decode($data);
$obj = $json_data->payload;
$fname=$obj->signup->first_name;
$lname=$obj->signup->last_name;
$nid=$obj->signup->nationbuilder_id;
// Assemble the body of the email...
$message_body = <<<EOM
first name: $fname \n
last name: $lname \n
nationbuilder_id: $nid \n
EOM;
mail('[email protected]','NB Webhook Data',$message_body);
?>

 

 

1 reaction

Please add Petitions and Petition Signatures to the NationBuilder API

This would be very powerful for a bunch of existing integrations as well as new ones. For example, it would enable a service like CallHub to support members signing petitions via SMS. It would enable email your MP tools to track against petition pages directly within NationBuilder. It would also enable tools to report on a nation's core activities and track successes across a great range of actions.

Ideally, it would allow developers of external tools to work with NationBuilder's petitions as well as petition signatures, in the same way that we can already work with events and RSVPs (that event resource provides the best analogy).

I would say the key components would be:

  1. Index endpoint (to return all petitions per site)
  2. Create endpoint (create a new petition)
  3. Show/update/delete endpoints (these are less important to us, but useful all the same :)
  4. Petition signature Count endpoint (return the number of people who have signed a given petition)
  5. Petition signature Index endpoint (return the NationBuilder IDs, first names and emails of everyone who has signed a given petition)
  6. Petition signature Create endpoint (add a new signatory to a given petition)

Thanks for considering!

considering

Thanks CodeNation! I'll move this over to the API forum for that team to take a look at! There isn't a timeline on this at the moment but definitely a good suggestion. 

Official response from

36 reactions

Please give us the ability to highlight streets without bubbles!!!

All I want in the whole world right now is to have the ability to give people walk maps without bubbles, and with highlighted streets. Too many bubbles on a street makes for an almost unreadable street map. 

I've even seen walk maps with directional arrows for people. Google maps used to have a tool for this. Would this be something NB could activate or employ? 

 

 

Add your reaction

Posting Financial Transactions

Would be great if the Donations API could be opened up to read/write or that the Invoicing function be added as a read/write API so that we're able to post different types of transactions info.  

For instance, an e-commerce solution could post customer sales back to the Nation either as a donation using a tracking code or by generating and closing an invoice.  

completed

We've opened up write access to nearly all the donation fields. You can find the docs on our main page, and you can also view the NationBuilder Donations API on Github here.

Official response from

14 reactions

POST/PUT endpoints do not work.

I'm using the NB api via PHP. The GET/DELETE methods both work but no matter what I try I can not edit or add a new people resource using the client->fetch() function.

The error code is always a 400 no matter how I format the parameters. Please help and don't give me a canned response to the API helper because I've spent 3.5 hours already trying various things in the documentation which is thin to say the least.

11 reactions

Precinct name when assigned by NBEC

The People API seems to return a blank result for precinct_name for a person when the precinct is assigned via the NationBuilder Election Centre. Is this a bug or by design? If by design, how do we manage this?

incomplete

Hey FieldEdge team -

I'm seeing this value in the person response, but not as currently documented. Are you able to fetch from the "nbec-precinct: nbec_code" parameter?

Official response from

1 reaction

Primary Address Create/Update through API

I would like to update a person's primary address through the API, and also be able to create a new person with an address. 

completed

Grigory,

Being able to update primary address via the API has been confirmed but does not have a set timeline on when it will be added to the people API. With regard to creating a new person with only an address, you must supply at least a first and last name, an email address, or a phone number.

 

Official response from

3 reactions

Provide a way to list surveys through the API that do not require them to be on a Page.

Hi folks,

I want to use the surveys to let canvassers add extra details while they are contacting people using an app I am designing. Right now I am getting a list of surveys by hitting /api/v1/sites/:site_slug/pages/surveys

However, this only includes surveys that have a corresponding page made for them, so the user must first make a survey and *then* add it to a page on a site. Not the easiest!

Is it possible to just provide an endpoint that lists all surveys without requiring them to be on a page first?

Thanks!

considering

This is something we will consider but does not have a timeline at the moment.

Official response from

2 reactions

Proving the identity of the logged-in user in 3rd party API calls from the Theme

How can I prove the identity of a logged-in user in a Nationbuilder theme to a 3rd party API that I control? As officially answered in https://nationbuilder.com/xdjc/making_nationbuilder_api_requests_inside_of_a_nationbuilder_theme, there's no way to get an API token or other token from Nationbuilder inside of javascript that can prove the identity of the logged in user to third party APIs. However, that answer also says the correct way to make Nationbuilder API calls from a theme is to set up a 3rd party API and call it from the template. So, how can I prove to the API that the request coming in is in fact coming from a logged-in user in nationbuilder and isn't being faked? And how can it verify the user ID is in fact who the user request says it is? Another way would be to use a HMAC with a secret key inside of liquid, but as officially answered in https://nationbuilder.com/xdjc/when_will_nationbuilder_liquid_support_the_hmac_sha256_filter, there are no hmac filters in nationbuilder either. So what's the recommended solution? Or do I just need to not have any authentication on the API, and just pray that the requests are really coming from a logged-in user on Nationbuilder and not a malicious actor?

incomplete

I've discussed this with colleagues and we are a little unclear as to what your aim is here. If someone is logged in as a control panel user, then they are able to access the data directly through the control panel. The API is not designed to be used in conjunction with control panel access in the way you describe. So there isn't a tool to facilitate authenticating control panel access. There shouldn't be any need to do this, as any data that could be surfaced via the API for a logged in control panel user could be accessed directly via the control panel. 
If you want to email more details of what you are trying to build to [email protected] we can take a look if there are other ways to achieve it.

Official response from

2 reactions

Pulling statistics from the API

I'm trying to display some data from our campaign on a dashboard (http://shopify.github.io/dashing/) by pulling the information through the API. I'm able to get the total number of people from the People index resource, but can't figure out how to do anything more complicated, such as the number of people with a support level of 1 or 2. I have a filter in my control panel for it but the closest I can get would be to add those people to a list and query that, which isn't dynamic.

Any thoughts or pointers?

Thanks.

1 reaction

PUT Method on Blog Posts API Example

Hi, i am reading the "Create Endpoint" article in the API documentation guide. I can't make   the Post request work.
Could you provide a php code where i can see how to create the body for the request?

I'm using this code:

$fetch = $client->fetch($baseApiUrl . '/api/v1/sites/johndoe/pages/blogs/1/posts/', $parameters = array($json_body), 'POST', array(
"Content-Type" => "application/json",
"x-li-format" => "json"
));

I get this message: "invalid_json".

 

Thanks in advance!!

4 reactions

PUT request

We're making a request to an offsite domain, and when I making a PUT request to the offsite server via $.ajax, it looks as if the authenticity token is being concatenated to the end of the stringified JSON object - this obviously causes problems when our offsite server attempts to parse the JSON object, it finds a "&authenticity_token=..." which is not valid JSON.

It looks as if the check of how the authenticity token should be appended (I snooped around a bit in the minified liquid files) is a bit naive. Yes, we're sending up JSON, but best practice (http://stackoverflow.com/a/12693986 <http://stackoverflow.com/a/12693986>) is to stringify with $.ajax first. The authenticity token attachment logic incorrectly interprets the stringified JSON to be a query string.

I have solved this for the most part by preventing this event handler from firing by including the 'global:false;' option in the AJAX request. Thanks!

4 reactions

PUT to people API via PHP

When i do something link this in PHP:

$params = array(
    'person' => array(
      'email' => '[email protected]','home_address' => array('country' => 'Germany', 'zip' => '66666' ))
);

$header = array('Authorization:' => $token,'Content-Type:' => 'application/json', 'Accept:' => 'application/json');
$response = $client->fetch($baseApiUrl . '/api/v1/people/push?access_token=myaccesstoken', $params, 'PUT',$header);
print_r($response);

i get the following response

Array
(
    [result] => Array
        (
            [code] => missing_parameters
            [message] => Missing Parameters.
            [parameters] => Array
                (
                    [0] => person
                )

            [inner_error] => Array
                (
                    [name] => Api::Error::MissingParameters
                    [message] => Missing parameters: person
                )

        )

    [code] => 400
    [content_type] => application/json
)

 

Whats wrong with the Parameters? Do i need to add something else to the Params?

 

 

 

13 reactions

Query Recurring Donors?

I'm trying to figure out the most efficient way to pull a list of people in my organization who are recurring donors. This seems to be relatively straightforward from the people admin page through the web portal, but it does not look like I can set a query parameter for this through the People API. It looks like the only way to do this is to go through the Donation API, but there it looks like I will have to make a very large number of API calls as there isn't an easy way to filter on this either. Is there an alternate solution? Thanks.

3 reactions

Recording Pledge Data via the API

I'm working for a non-profit that is running a pledge drive, and has pledge form on its website.  Is there any way we can move pledge data into NationBuilder via the API?  I don't see pledges referenced anywhere in the documentation.

6 reactions

Remove Questions

I thought questions where associated with a specific Survey (given that that's how they're added via the API). But when I delete a survey the questions persist.

Is there any way to delete questions?

Add your reaction

Reports dashboard with number count of prospects in a filter?

I'm interested in creating a status page with a live count of the number of people in a given filter.

For example: Team A is responsible for getting prospects from a specific area to join a nation.  A filter is created that shows 'joiners' from that specific area.

I want to create a page that then shows (live) the number of supporters in a specific filter.  I would then be able to show this for multiple teams to compare/contrast their progress.

In the API Explorer I saw there's something for lists (which aren't dynamic) but not filters...

Can this be done?Thanks for any help with this.

2 reactions

report spam

We've been hit a lot recently with spam signups. Its takes a long time to delete 100 spams entries with "edit", scroll down, hit "spam", then "ok". Can you please add an option for "report spam" the right side of the page along with "edit" "add to list" "delete"?

Add your reaction

Request an Activity Stream API

I would like an API to access the Activity Stream, as the Contacts API is only showing a portion of the communications relevant to a person.  My present objective is simply to access the same information as is shown in the People dashboard in read only format.

3 reactions

Request Date Field in Contacts API

As noted else where in support, Contacts apparently default to date the contact was entered, and don't allow option to edit date to that on which contact actually occurred.  This, ought to be fixed generally, and the option to edit the date added to the Contacts API

8 reactions

Request Followups API

Would like an API to access followups set for a person (or all persons) and assigned to a user (or any user).

22 reactions

Request for a webhook on petition signature

This would be radical.  Thanks!

1 reaction

Required JSON format structor

Hi,

I am very curious as how you guys know what fields are required for any JSON format. There is no example of what is required or not. Can anybody shed some light?

Thanks.

 

Ryan

1 reaction

response

Does anyone actually monitor this page? I've posted suggestions but hear nothing back, and see no changes made. Are we wasting our time here?

Add your reaction

Response Codes

Where is there a list of all the Response Codes?

1 reaction

retrieve information about current user on external site

Hello! Is there a mechanism for retrieving information about the current user in order to customize the experience for members who are interacting with external sites? With other CRMs we're able to identify the current user either through a cookie that is set via tracking redirect when members click links in emails sent by the CRM, or via a token included as a URL parameter appended to links in emails that are sent via the CRM. We use those tokens to retrieve information about the member when they reach our platform. It allows us to skip form completion steps by simply reusing the biographical information already stored in the CRM for that session. I think we asked NationBuilder about this feature years ago, but bumping it up in case something has been added to support this feature in the mean time. We just had another customer ask us for this in order to support one-click signing of petitions without requiring the user to provide email & name each time.

considering

Hi Nathan,

Unfortunately the URL parameter appended to links in an email blast can still only be decoded on a NationBuilder page. With that being said, you can certainly append the user's NationBuilder ID number or any other signup variable to the URL in a non-encoded way. For example, if your NB ID number is 29378, you could type www.example.com?id={{ recipient.id }} into a blast to send them to www.example.com?id=29378. The you would need something on the other site to read and interpret the ID, which would be the more difficult part. If anyone has other suggestions, I am open to hearing them!

Thank you,
Brian Palmer
NationBuilder Support Technician

 

Official response from

2 reactions

Return a better error message when an API call is made to a nation, endpoint that does not exist

When making an API call to an invalid endpoint the response returns the HTML from a 404 page. A response body describing the issue (endpoint does not exist, nation does not exist) along with a 404 status would be preferred for debugging issues.

Example:


[17] pry(main)> NationBuilder::Client.new("foo", "bar").call(:donations, :index)
NationBuilder::ClientError: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>404 Error: The page you were looking for doesn't exist</title>
<style type="text/css">
body {
background: url(http://nationbuilder.s3.amazonaws.com/assets/404-grass.jpg) repeat top left;
color: #fff;
font-family: Lucida Grande, Lucida Sans Unicode, Garuda, sans-serif;
margin: 15px 0;
font-size: 1em;
}
#wrapper {
padding: 15px 0 0 45px;
}
#headline {
font-size: 2em;
font-weight: bold;
text-shadow: -1px -1px #333;
color: yellow;
}
#description {
font-size: 1.3em;
line-height: 1.8em;
color: #fff;
text-shadow: -1px -1px #333;
}
#footer {
clear: both;
font-size: 0.8em;
}
a:link, a:active, a:visited {
color: #ec7c31;
text-decoration: none;
}
a:hover {
text-decoration: none;
background-color: #fee34c;
color: #000;
}
#road {
margin-top: 15px;
}
</style>
</head>

<body>
<!-- This file lives in public/404.html -->

<div id="road">

<div id="wrapper">
<div id="headline">We couldn't find the page you were looking for.</div>
<div id="description">You may have mistyped the address or the page may have moved.</div>
</div>
<div id="road"><img src="http://nationbuilder.s3.amazonaws.com/assets/404-road.png" width="952" height="404"></div>
</div>

</body>
</html>
from [...]/gems/nationbuilder-rb-1.5.0/lib/nationbuilder/client.rb:129:in `parse_response_body'

considering

This is something we will consider but does not have a timeline at the moment.

Official response from

1 reaction

Returning people including expiration date

I'm working on an integration tool to create newsletter labels for our members. It seems I can get the GET /api/v1/people endpoint fine but not with the expiration date, as this returns an abbreviated member. I'm aware there is the /person/:id endpoint, but this would affect acceptable usage to have to call this for every user in the database (currently >1000).

Given memberships are such a big thing with the types of organisation on NationBuilder, I would think this is going to be a popular endpoint if added.  What we really needed is an endpoint that returns an abbreviated member record that also includes an expiration date.  At the moment it seems that what we want to accomplish isn't possible, particularly with the rate limiting currently in place.

For what it's worth in our previous system we pulled all records from a local database to determine the labels and which need renewal forms to be added.

A less ideal alternative would be a variant to /match or /search with a parameter with an expiration date range option.

4 reactions

Ruby tips: Debugging, layout and documentation

Our CTO, Dan Walmsley, spotted these helpful tips from globaldev: 

http://globaldev.co.uk/2013/10/ruby-tips-part-4/

Add your reaction

Search by any parameter

I’m working with my nation’s donation data, and I’d like to be able to search by more than just succeeded since, created since, failed since, and donor id. 

Is there any reason why I can’t pass tracking_code_id as a search parameter, or any of the other fields? Right now, my flow looks like this: 

Pull the entire list of donations that might match (say, by succeeded since date, or just pull them all)
Parse through and check the value/run my own search algorithm on the entire results I just pulled 
Do my processing 

Since I’m sometimes interested in searching all of our donations, that means each time I do this, I’m pulling down almost all of our donations, even if only 5-10 of them will match a criteria, like a tracking_code_id – it’s much slower than it needs to be, I think. 

Have I missed something? Is there a better way to use the search endpoint? What’s in the way of giving us access to this?

considering

Tyler,

At this point we have only exposed the succeeded_at, created_since, failed_since, and donor_id search params for the donation search endpoint. There is not a way to run a targeted query via the API for just tracking codes.

We will consider adding a tracking_code_slug param in the future and will update this card and notify you when that is complete.

Official response from

5 reactions

Searching people returns invalid json format error

I am searching people using this url:

https://malaysia.nationbuilder.com/api/v1/people/search?access_token=my_tokken

with header "Content-Type: application/json" and with following request body:

{"first_name":"abc"}

but it gives me error that json format is invalid

 

completed

You can accomplish this search with a cURL command wrapping your JSON into the URL. See below for the command you can run in Terminal:

curl https://malaysia.nationbuilder.com/api/v1/people/search?access_token=[my test token here] -X GET -H “Content-Type: application/json” -d ‘{"first_name":"abs"}’ 

Official response from

3 reactions