Skip to content
Aaron Schachter edited this page May 20, 2016 · 6 revisions

Network Requests

https is used for all protocols.

Docs: Northstar API | Phoenix API | News API

Authentication

  • POST northstar.dosomething.org/v1/auth/register?create_drupal_user=1

  • POST northstar.dosomething.org/v1/auth/token

  • POST northstar.dosomething.org/v1/auth/invalidate

Current User

  • GET northstar.dosomething.org/v1/profile -- Used when continuing a saved authenticated session. We inspect the Current User's saved device tokens (stored in parse_installation_ids) and then POST to same endpoint if we have a new device to save.

  • POST northstar.dosomething.org/v1/users/:current_user_id/avatar

  • POST northstar.dosomething.org/v1/signups

  • POST northstar.dosomething.org/v1/reportbacks

Campaign

  • GET www.dosomething.org/api/v1/campaigns/:id

  • GET northstar.dosomething.org/v1/signups?user=:current_user_id&campaigns=:id

  • GET www.dosomething.org/api/v1/reportback-items?load_user=true&status=approved,promoted&campaigns=%id&count=50

Profile

We only need to load a User's signups because we get passed a user object in the reportback-items response when viewing a Campaign (or from the [DSOUserManager sharedInstance].user if Self Profile).

  • GET northstar.dosomething.org/v1/signups?user=:id&count=200

Actions

  • GET http://live-ltd-news.pantheon.io/api/get_category_index/ -- Cause List (initial Actions screen)

  • GET www.dosomething.org/api/v1/campaigns?term_ids=:id&count=100 -- Cause Detail list of Campaigns

News

  • GET http://live-ltd-news.pantheon.io/api/get_posts?count=50/ -- News Feed

Notes

Count parameters

We're setting the count in query string as a hack until getting to infinite scrolling (#967).

Current User language + Campaign status

Northstar authenticates against the Phoenix API using the credentials of a single API account. When posting Signups and Reportback requests, Northstar passes the Current User's ID in the body of the POST request in order to associate the Signup or Reportback with our Current User.

In Phoenix, the Campaign status is returned as either active or closed based on the start/end dates of the Campaign's Current Run of the authenticated Phoenix user's language. This means scenarios can exist where a user with language set to US English may see Campaign 123 as closed, and a user with language set to Vietnamese could see the same Campaign 123 as active.

The Northstar API user that authenticates against Phoenix has language set to US English, thus the Campaigns endpoint returns all Campaign status values per the Campaign's current US English Run dates.

A future release could collect the Current User's preferred language and display Campaigns accordingly, upon API support for querying for Campaign status based on language (refs phoenix#6251).