Skip to content

Latest commit

 

History

History
107 lines (66 loc) · 2.67 KB

README.md

File metadata and controls

107 lines (66 loc) · 2.67 KB

We the Users

Backend services for the We the Users campaign

Getting started

npm install
gulp runServer

The server should now be running at 127.0.0.1:3200 by default

Configuration

App configuration is controlled using the node-config module

The JSON files containing configuration are all under /config. Production configuration mostly uses the JSON files, with a couple of heroku specific vars picked up via environment variables.

API

POST /api/1/signatures

Description

Creates a new signature object on the server and queues it for processing via the We The People API

Parameters

See the signaturePOSTSchema object for the Joi schema definition

  • firstName (required) - The first name of the petition signatory
  • lastName (required) - The last name of the petition signatory
  • email (required) - The email address of the petition signatory, required to validate their signature
  • subscribeToEmails (required) - The short code (EFF, FFTF etc.) of the organization the wants to join the mailing list of
Response

An object with the following keys and values:

  • status - The request's status, should always be success
Example

Request

POST http://127.0.0.1:3200/api/1/signatures

Return

{
  "status": "success"
}

GET /api/1/signatures/{email}

Description

Fetches the signature object matching the supplied email

Parameters

See the signatureGETSchema object for the Joi schema definition

  • email (required) - The email address of the signatory whose signature should be fetched
Response

An object with the following keys and values:

  • firstName - The first name of the petition signatory
  • lastName - The last name of the petition signatory
  • email - The email address of the petition signatory, required to validate their signature
  • subscribeToEmails - The short code (EFF, FFTF etc.) of the organization the wants to join the mailing list of
  • isValidated - Whether the signature has been validated
  • sentToWhiteHouse - Whether the request has been dispatched to the WTP API
Example

Request

GET http://127.0.0.1:3200/api/1/signatures/test%40test.com

Return

{
  "firstName": "Leah",
  "lastName": "Jones",
  "email": "[email protected]",
  "subscribeToEmails": "EFF",
  "isValidated": false,
  "sentToWhiteHouse": true
}