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!
calling /people/search with a custom field
Hi! I'm trying to call the people/search endpoint, searching on a custom field. As per the documentation it seems the url below would work for searching for us_citizen=true, but it returns a 500. Suggestions on what I'm doing wrong? Thanks! https://mynation.nationbuilder.com/api/v1/people/search?custom_values=custom_values%5Bus_citizen%5D%3Dtrue&limit=100&access_token=XXX Heather
How to get the registered address throught the API
Hi, It is possible to get the primary address, but I can not find a way to get the registered address. What can I do? Thanks
Use NationBuilder as an SSO provider
Hi, We would like to make NationBuilder more central in our infrastructure. We would like to build on top of it. Is there a way to authenticate users in our Mobile App with NationBuilder. And I am not talking about authenticating the Admins. This is what OAuth2 is for. I would like to authenticate the users in our nation that are thousands. We would like to keep certain information in our NationBuilder. Information about the user membership. A custom field that says if this use has access to our venue or no. That's it. We would like to give our users (not the nation builder admins) but the nation itself a Mobile App. A mobile app that will read this custom field and say to the users (not the admins, but the users in the nation) if they have access to our venue. The issue is that if a user has a Mobile app on their phone there is no way for them to authenticate with nation builder. NationBuilder is not an SSO Provider and there is no API endpoint for an App to check the username and password of a user using the Mobile App. So we can build web/modile apps for the nation builder admins, but we can not build web/mobile apps for the nation builder users, those that are part of our nation. What am I missing? Help me understand how could we build web/mobile apps that allow us to authenticate the users in our nation (not the admins of the nationbuilder.com installation) with NationBuilder. Thanks.
Mobile App Development Company
Which is the Top Mobile App Development Company in India?
I am facing issues with http and https to https//www.
I am facing issues with http and https to https//www. is not redirect. http is redirecting https//www. but https is not redirect. Can anyone suggest me how we resolve it
Swagger / OpenAPI Spec
I can't find any api documentation of type Swagger or OpenApi specification. Is there a hidden one ? If not, could you add one ? Thank you
client_credentials grant type
Hello, Looking at the Authentication process, could you implement the client_credentials grant type ? It would help authenticating from machine to machine without having to rely on a user account. It would allow those who don't like long lived tokens for their security risks to have an alternative. Many thanks
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.
Page attachment link location
Is there anywhere we can find the url of page attachments in the snapshot?
Google App Script API problem
I am having an issue with a simple app script to create a person record in NationBuilder. I've checked my JSON data and verified it with REQBIN and it works in the API explorer. The error is "I can only talk JSON. Please set 'Accept' and 'Content-Type' to 'application/json'" I have both of the attributes in the options model. I've even tried every possible capitalization combination.??? If anyone has some google app script that is known to work, I would really appreciate it. Everything I have found so far isn't working. TIA.
completed
I am happy to take a deeper look at the code you are using. I haven't received any other reports from other customers on this recently and I am currently using the create a person API fairly regularly.
Would you be able to send your code to me at [email protected]?
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.
When will Nationbuilder Liquid support the hmac_sha256 filter?
Currently the only way I can find to have a nationbuilder theme make a secure API call is to hash some auth info about the current user in the template with a secret key. Shopify Liquid and most liquid variants support the hmac_sha256 filter (https://shopify.dev/docs/themes/liquid/reference/filters/string-filters#hmac_sha256) for this purpose, and have for several years. However, sadly this is not available in nationbuilder yet. The only hashing function available in nationbuilder liquid is md5, which is much less secure and isn't a hmac. When will nationbuilder liquid support his important hmac_sha256 filter? I think given how much nationbuilder's users are targets for hackers, it's absolutely essential for nationbuilder to support the hmac_sha256 liquid filter.
completed
We added the hmac_sha256 as well as sha256 and hmac_sha1 filters in November 2021. As of yesterday we also have hmac_sha512 available for liquid templates. Documentation can be found here.
Making Nationbuilder API requests inside of a Nationbuilder Theme
I need to be able to make calls to the nationbuilder API inside of a nationbuilder theme on behalf of the current user. Is there a way to get an API token for the user inside of a template? I see there's _nbuild_token and _nbuild_session cookies, but those don't work as API access tokens. I don't see any liquid template variables that look like they would be useful in getting an access token for the current user. Alternatively, I can set up a REST server that can make calls to the nationbuilder API, and make requests to that from my template. However, I need some way to verify who the user is that's making that call. If I send the _nbuild_token and/or _nbuild_session from the cookies along with the REST request, is there some way to verify which user_id that token belongs to on the backend? I just need some way to validate that the user making the request is a logged-in user on my nationbuilder site so I know what they should or shouldn't have access to.
completed
It isn't possible to use the API token from within the website theme. You will need to run the requests separately as you suggest.
Regarding controlling the display, you will need to use our request variables in liquid conditionals to test whether the user should see the content.
Cancelling the recurring donation
How to cancel a recurring donation? By looking at API documentation I've noticed that each donation has two fields: recurring_donation_id (which is not writable) and canceled_at.
What is the best way to fetch all field keys of people in a nation?
I have searched through the API docs and developer forum and do not see an endpoint for fetching a list of the keys in a nation. I would like to bring back all of the standard fields as well as the keys of any custom fields in the nation. The only route I see is to fetch a person and pull the keys from the response. I'm concerned this may not return all of the keys present in the nation if this one person has null values for some keys.
Webhooks: how to comunicate success received
Sorry for the question, i'll receive a lot of equal webhook callback, Is there a way to prevent this ? i don't know, for example reply with an empy body with status code 200? thanks for help
Is it possible to update multiple people in a single query?
Is it possible to update multiple people in a single query? The only option I see is the /people/push endpoint, which accepts a single person.
submitted
It isn't possible to update multiple people in a single query. You'll need to make a call to the push endpoint for each person you wish to update.
I would like to get specific home_address and work_address information from the /people endpoint
I am fetching a batch of people from the /people endpoint. I want the contacts' home_address and work_address values. My understanding is the /people endpoint is only capable of returning the primary_address and if I want to get the home_address, work_address, or other specific address, I would need to query the /people/:id endpoint. I'd rather query the /people endpoint just once rather than the /people/:id endpoint once for each and every contact. Is it in fact possible to fetch specific addresses with the /people endpoint?
submitted
It's not possible to access specific address types in the Index endpoint. This will always show the abbreviated Person resource, which includes only the primary address. You will need to use the show endpoint to access the specific address types.
personal transaction history
How can I get person specific transaction history? Complete records a person has in Nationbuilder with timestamp?
Designing a theme in a different software then importing to NationBuilder
I would like to design my nation in Webflow because that's what I already know how to use. Im not a developer; Im a marketer. How could I import this design into NationBuilder? Looking into the documentation a bit, I think i'll have to export the Webflow theme in Bootstrap format if possible? Then go and manually import each of the bootstrap files into the right places in the NationBuilder DropBox Bootstrap layout? Would anyone want to do this for me for a fee?
Event details missing from API
I'm attempting to check the tags that will be added to users when they RSVP, but that attribute does not appear to be returned by the events API. We get the page tags, but not the RSVP tags. Seems like those are saved here — [signup_action_callbacks_attributes][0][tag_list] When setting up any number of events, it's very easy to miss a setting, and this is a major point of pain for my nation — if an event goes by and the RSVP tags are missing, we've got a whole set of people mis-tagged. I'm just trying to build a tool that would flag those events so we can fix them — so I'd only need read access to this attribute. Wondering if there's any way I can get access to this attribute on events?
Set address used as primary address
Using the API, how can I update which address is currently used as the primary address? e.g. mailing, home, billing, ... It would also make sense if the person object included which address is currently set as the primary address. This is helpful to know which address to update.
submitted
It isn't possible to change which address is the primary address via the API. If it is not set manually in the control panel, the primary address is set automatically to the first present address in this hierarchy:
1. home
2. registered
3. billing
4. work
5. mailing
6. user-submitted
7. Twitter
If you wish a different address to be the primary for a group of records, you would need to run a batch update in the control panel.
Webhooks do not immediately trigger when adding a tag
When adding a tag to someone in your database, the 'person changed' webhook will not fire until you save that profile or a different profile in the database. This makes syncing tags with an external database a challenge.
Oauth2 token validation REST resource
Is there a way to validate authorization token? For example, Google has such an endpoint https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=MYTOKEN which returns token info if it is a valid one. It is doable with Facebook as well. graph.facebook.com/debug_token?input_token={token-to-inspect}&access_token={app-token-or-admin-token} Does Nation Builder provide similar endpoint? Thanks
considering
There is not an endpoint to allow authorization token validation but is something we are considering. There is no timeline at this moment for when this feature will be rolled out but please follow this request to get email updates.
API imports result call returns an empty failure_csv field.
When importing people using the import call from the API, although the Errors CSV file is available in the people import report, and that the correct number of failure is reported in the response, the field failure_csv is returned empty (null). Here's an example of responses: {"result":{"rows_updated":0,"rows_succeeded":0,"rows_failed":9,"failure_csv":null}} {"result":{"rows_updated":2360,"rows_succeeded":2612,"rows_failed":24,"failure_csv":null}} The response match exactly the report on the control panel, except for the file which is only available on from the control panel. The following params are used for the import call: 'type' => 'people', 'file' => [base 64 encoded csv file], 'is_overwritable' => 'true' Thanks for your help.
completed
Unfortunately it isn't possible to access the error file via the API. I have corrected the error in our documentation that suggested this was possible.
Thanks.
Add user to the nation builder after registration on wordpress site
How can I add user to the nation builder after his registration on wordpress site
completed
You can develop an API connection between your WordPress site and NationBuilder. Learn more from our quick start guide about this process.
There is an existing application called Gravity Forms that some NationBuilder users use with their WordPress websites to establish a connection between the two platforms. You can also use a 3rd party NationBuilder integration such as 123FormBuilder.
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.
Inconsistent API Functionality
I suspect this is custom validation used across many API endpoints, but I specifically refer to the People Memberships endpoint (i.e. PUT to /people/:person_id/memberships) The validator rejects null values for expires_on, and will only accept strings. If we want to set expires_on to null, we must send it a non-date string. The API will reject "expires_on": null with an error, but will return "expires_on": null if the attribute sent is "expires_on": "". Further, the validator does not catch non-date strings. Sending "expires_on": "donuts" also results in the response "expires_on": null. Really, the output should match the input, and the date validator should check to see whether the attribute sent matches a valid value (i.e. ISO8601 date or null). Instead, the validator only rejects null values and the API translates any non-ISO8601 string to null.
submitted
Jeremy,
You are right about the "donut" example but I can't replicate the other validation error. When I make the request and set "expires_on" to null I'm returning a 200 with the response body including "expires_on": null.
Please let me know if I'm misunderstanding the error or how you submitted the request to get the validation error.
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
Blog Posts by Author
Is it possible to get a list of blog posts created by a specific author via the API? If so, can you link me to the page with the info for this because I cannot seem to locate anything about it. Thanks, Wil
completed
Unfortunately there is not a search endpoint for blog posts. As an alternative, you could Index all blog posts and then have your own app search specifically for the author_id field.
Documentation Error
Hello, I found a small mistake in the API documentation. On https://nationbuilder.com/people_api under the Push Endpoint, it says " If a match is not found, a new person is created and a 201 status code is returned", which is correct: https://cl.ly/rUFV But further down the page under "Creation example" it says "A new record will be created with the provided attributes and you will receive a response of status 200" (note the 200 instead of 201): https://cl.ly/rV8G Minor issue, but wanted to let you know! Thanks!
completed
Hi Alex, thanks for bringing this issue to our attention. Indeed, when a person is created via the Push Endpoint, the 201 response code ought to be the accurate result, not the 200 response code. We've updated the People API documentation accordingly.
API Access for Development
Our organization is using Nation Builder for their website and we would like to start developing a tool to manage our Blog, which will need to hook into the Blog API. I can easily code this, but need to get access to the API. What steps do I need to perform in order to gain access to the API? Thanks, Wil
'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.
Incorrect Donations API documentation
The /donations/index endpoint has a maximum limit of 1000, not 100. https://nationbuilder.com/donations_api#index_endpoint
completed
An update has been made to the API restricting the max number of results per request to 100.
On creating Person, primary_address not rejected
The /person endpoint is generally quite strict on push, and it rejects invalid attributes on the object passed to it. For instance, fields which do not exist on the object or under custom fields will return a 400 with the error code "invalid_custom_field". However, the pseudo-attribute primary_address is accepted but no action is taken if it is passed. This should either be handled (i.e. a new address is created and assigned to the person), or the request should be rejected as invalid.
Issues with country_code attribute of Address resource
The Address resource documentation under the People API describes the country_code attribute as "country code". However, it appears the standard being used is ISO-3166-1 alpha-2 with upper-case characters. This is a requirement, entering a code which doesn't comply with this causes problems with NationBuilder's front-end. However, these requirements are not documented nor are they verified when an address resource is submitted.
completed
Great point Jeremy. The documentation has been updated to reflect this:
https://nationbuilder.com/people_api
https://github.com/nationbuilder/api_docs/blob/master/doc/people_api.md
How can a nation identify itself to an installed app?
I am building an app integration. I've implemented the OAuth flow described at https://nationbuilder.com/api_quickstart. Suppose that two nations, N1 and N2, both install my app. As a result of following the OAuth flow, my app has now obtained API tokens for both nations, so it can make API requests on behalf of either one. I want to limit who can prompt my app to act on behalf of a given nation. For example only someone affiliated with N1should be able to prompt my app to access N1's data via the NB API. Conversely someone affiliated with N1 should not be able to prompt my app to access N2's data. In order to limit access appropriately, my app needs a way to know which nation is asking it to do something. How can nations identify themselves to my app in a secure way?
completed
Usually the apps are authenticated through OAuth for each individual nation. It wouldn't be a good idea to let people who install your app to have access to all other nations who are authenticated through the app. In general, each nation will have individual OAuth Client ID's, Client Secrets and Auth Tokens. Since only admins of that nation can generate auth tokens (through the OAuth process), it should inherently be impossible to access data from another nation from within your app (depending on how it was built). Apps are identified through the Client ID and Client secret that are registered individually through the Developer tab in NationBuilder from within each specific nation.
If you could send us more specifics on how you are building the app, we would be happy to help suss this out with you!
Please send us an email to [email protected] and we can work with you on getting this resolved.
API Explorer broken on donations and people search endpoints
As per my previous two posts concerning these matters, the people and search endpoints return a 400 when provided with unexpected URL parameters. The API Explorer provides them with one of these, __proto__. This should be removed so that the API Explorer actually works on these endpoints. https://nationbuilder.com/jeremyunite/bad_request_on_people_search_endpoint https://nationbuilder.com/jeremyunite/bad_request_on_donations_search_endpoint
considering
Thanks for noting this Jeremy. We have flagged it with our product and engineering team. There is no set timeline on when this change will go into effect but we will update this posting when it does.
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?
submitted
At the moment, we don't have a tool to generate a listing of all donations per person ID. The current way to find all of the donations for a person ID is to request all of the donations and run a query through the json data to pick out the donations that contain that specific person ID. You can see the available options through our API explorer here:
https://apiexplorer.nationbuilder.com/nationbuilder#Donations
We have not prioritized any work to create a person ID search through the Donations API. If we add this work into our plans, we will provide an update on this post accordingly.
Bad Request on /donations/search endpoint
Similar to my previous post, this endpoint is also needlessly strict. The API Explorer is also broken on this as a result. These endpoints need, at the very least, documentation explaining the inconsistent strictness, and the __proto__ URL parameter needs to be removed from the API Explorer. Moreover, this requirement to not include any unexpected URL parameters should be removed from the endpoints.
submitted
At the moment, we haven't prioritized work to display errors if a user submits unexpected URL parameters. The current implementation shows an error, but it is a generic 400 error. If we prioritize work to change this behavior, we will update this post here.
Donations API Documentation
http://nationbuilder.com/donations_api The Donations API description of the is_private field reads "false if the donation should not be posted publicly on the site". Is this correct? If is_private == false, then the donation is private; and if is_private == true, then the donation isn't private?
completed
I can definitely see why that language has caused confusion. The "is_private" field relates to a check box in the nation called "Don't post this publicly on the site" so when marking "is_private" as false you're unchecking that box meaning you do want the donation to display. Setting to true checks the box meaning you do not want it to display. I've updated the section in http://nationbuilder.com/donations_api
Bad Request on /people/search endpoint
If any unexpected parameters are sent to the /people/search endpoint, it fails with a 400 Bad Request, and doesn't explain further in the body text. This is a problem, especially considering the API Explorer adds an empty __proto__ URL param, which is rejected by the API with the message above. Really, the API should ignore any irrelevant URL parameters, rather than just mysteriously dying. If there's a technical limitation around these for some reason, the response text should at least be more verbose.
completed
Overall, we don't have any specialized error reporting through the API. If the request is incorrect, you are properly sent back a 400 bad request (or other respective response). We could set up the API to provide errors depending on typos or if the request contains irrelevant URL parameters, but we haven't prioritized this sort of project. As an alternative to the API Explorer, you could use your own tools to send requests through our "REST API" in NationBuilder. For example, you can use "curl" to send requests through terminal on a Mac (or command prompt on Windows).
Custom fields – Define Text vs Checkbox
Currently, custom fields return a name and value. In the case of the Checkbox field type, there is no way to tell this apart from a Text field type. Where the custom fields for each nation is unknown, it is impossible to tell them apart and you end up with a situation where checkbox custom fields have to display a value of 1 or 0.
API Explorer not generating calls or any JSON
I just generated my first test token and have submitted it on the API Explorer along with my nation's slug. However none of the endpoints are generating any JSON feedback. In my browser Explorer, I see the following error in my console: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data. Can anyone help? Do I need to follow any additional steps to get the API Explorer working? I just want to set up a simple AJAX call within my nation's page template. This is my first time using the API. Any help is really appreciated! Thank you.
completed
I tested the API explorer on our end using a known functional API token and I wasn't able to replicate the issue you have described.
Could you reach out to us with the nation where you generated the test token? I would be happy to test out the token you are using on your end to make sure that the tokens are valid.
Tags Endpoint Doesn't Accept Forward Slashes
I'm trying to use the GET /tags/:tag/people endpoint, searching for a tag such as "Ajax/Bowmanville" and getting a 404 response. It works fine with a tag like "Ajax-Pickering" which doesn't have the front slash. I've tried replacing the front slashes with %2F, as suggested here http://nationbuilder.com/mdunbar50/issue_with_space_and_in_people_tags_search but it doesn't help. Any advice would help! Thanks
considering
We have confirmed this bug but do not have a timeline for when a fix for this issue will be implemented. But we've noted it and will post any updates here.
Using Nationbuilders donation form on Wordpress
Hi I'm working on moving a Nationbuilder site over to Wordpress for the CMS. There is a request to keep the donation form the same, but it looks to me like this is not possible. I think I can use a Wordpress donations integration/plugin and after a donation is taken, send the information to the Nationbuilder API. Is it possible to use the nationbuilder donations for with Wordpress? Or is that a no go?
completed
There are several approaches to this:
- Use WP for the rest of the site and NB for the donation form. The way this would work is that when someone selects a 'donation' button on the WP site they will be redirected to the NB donation form to process the payment.
- Use WP for the entire site and build an application that can consume processed donation data from the payment processor and make a request to our donation API to create a record of the transaction.
- Redirect from the WP site to a payment processor that integrates with our donation API which will create the record in NationBuilder without you having to build an application as mentioned in (2) above.
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?
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
Deleting an address
How can I delete an address through the API? I have tried using the people/:id endpoint but if I pass an object with something like "home_address": null it doesn't do anything. If I pass an address object with all the components set to null (ie { "address1": null, "address2":null, etc. }) I can see from the main GUI that the components have indeed been blanked but there is still a "delete address" button, which suggests that the address still exists on the system albeit with blank components.
completed
When clearing out the address types (home_address, billing_address, registered_address, or mailing_address), you would need to pass empty strings and null with the request.
For example, you could use this curl with the PUT request on the People endpoint here:
curl -v -X PUT --header "Content-Type: application/json" --header "Content-Type: application/json" —data '{ "person": {"home_address": {"address1": "","address2": "","address3": "","city": "","county": null,"state": null,"country_code": "","zip": null,"lat": null,"lng": null,"fips": null,"street_number": null,"street_prefix": null,"street_name": null,"street_type": null,"street_suffix": null,"unit_number": null,"zip4": null,"zip5": null,"sort_sequence": null,"delivery_point": null,"lot": null,"carrier_route": null}}}'https://NATIONSLUG.nationbuilder.com/api/v1/people/PERSONID?access_token=TOKEN
Make sure to change NATIONSLUG to the slug of your specific nation, PERSONID to the ID of the person you are looking to update in your database and change TOKEN to your API token that you can get through Settings > Developer > API Token.
If you continue to have problems with clearing out the address fields, let us know and we would be happy to help through email at [email protected]
NOTE - this is not a solution for redefining a primary address as whilst you will be able to empty the address you will not be able to re-add that address as the “primary” designation remains even once the address no longer has data in it.
Endpoint for primary_country and registered_country?
The export csv contains address fields such as “primary_country” and “registered_country”, which contains the name of the country. The API People-endpoint does not contain those fields. The API does contain the “country_code” key. Is there another endpoint that allows me to read/write to the country name fields e.g. “primary_country” and “registered_country”?
completed
In general, you wouldn't be able to write to any specific "Primary" information because "Primary" is an address category and not a specific address type. For example, you are able to write to billing address, mailing address, registered address or home address and each one of those address types could be listed as the "Primary" address within the Control Panel.
For example, if you wanted to add a country code to the registered address for a person in your database, you could send this json payload with your POST or PUT request through our API:
{"person": {
"registered_address": {
"state": "TX",
"country_code": "US"
}
}
}
Similarly, you can change out the "registered_address" with "billing_address", "home_address", or "mailing_address", depending on which sort of address country code you are trying to modify.