Giter VIP home page Giter VIP logo

ngpvan-api-example's Introduction

ngpvan-api-example

This project is a sample web app that illustrates use of the NGP VAN API. The functionality found here is similar to what you might find on the website of a progressive political candidate:

  • Volunteer signup
  • Event RSVP
  • Collection of canvass data
  • Voter file match

All of these features are backed by the NGP VAN API in one way or another.

The coding framework here is .NET MVC, although it is certainly possible to build equivalent functionality in any number of other frameworks.

We also provide a bash script that includes a set of cURL commands for executing API calls similar to those found in the web app, as well as a Postman collection that allows you to run the same API calls in Postman - though it is easy enough to use other API clients to execute these API calls.

The keys used in these examples and included in the source code are no longer functional. However, if you wish to experiment with our API, we encourage you to request an API key!

ngpvan-api-example's People

Contributors

sgani avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

joemcl

ngpvan-api-example's Issues

adding multiple new Locations?

Hi @shaisachs . Thanks so much for this and for demo'ing it at Netroots a couple of years ago :) .

I'm stuck, and I know you've left NGPVAN ( :( for us, :) for you ), and I've sent the same question into the official NGPVAN dev support folks. Figure you know the VAN API better than anyone. And once I figure out the answer, I'll do a PR against your doc here.

So, I want to add a bunch of new Locations, using curl and json. I'm able to add a new location, like this:

curl -H "Content-type: application/json" \
       --user ""my_app_user_ID":"4e7c"|1" \
     -X POST  \
--data '{"name": "JOETestLocation3",
 "address": {
   "addressLine1": "123 main st",
   "city": "Irvine",
   "stateOrProvince": "CA",
   "zipOrPostalCode": "92620"
 }
}' \
https://api.securevan.com/v4//locations/findOrCreate

but not able to add multiple locations, like this:

curl -H "Content-type: application/json" \
       --user ""my_app_user_ID":"4e7c"|1" \
     -X POST  \
--data '{
“locations”: [
"name":"Blue Gum Park",
"address":{"addressLine1":"14 Aberdeen","city":"Irvine","stateOrProvince":"CA"}},{"name":"Brywood Park","address":  {"addressLine1":"15 Westwood","city":"Irvine","stateOrProvince":"CA"}},
{"name":"Canyon Park","address":  {"addressLine1":"6 Canyon Park","city":"Irvine","stateOrProvince":"CA"}},
{"name":"Carrotwood Park","address":  {"addressLine1":"60 Bennington","city":"Irvine","stateOrProvince":"CA"}},
{"name":"Chaparral Park","address":  {"addressLine1":"19032 Turtle Rock Drive","city":"Irvine","stateOrProvince":"CA"}}] }’  \
https://api.securevan.com/v4//locations/findOrCreate

Admittedly, my JSON game is not the strongest. But when I try variations of the above, I get this error message:

"errors": [
    {
      "code": "INVALID_PARAMETER",
      "text": "The body of the request is null or cannot be parsed."
    }
  ]

So I guess my question is - what is the correct format for uploading multiple Location records in JSON into VAN so that they are parsed correctly?

I've been poring over the VAN dev docs at https://developers.ngpvan.com/van-api#van and I'll be searching on Stack Exchange for clues as well.

Thanks so much for any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.