Search

Filtering Responses

Some GET methods provide optional filter parameters you can include to narrow API results based on various criteria. The following sections show how to use some filter parameters to get data on campaigns, donations, and users. This page contains the following topics: 

Use one of the following URLs to open the API reference.

Test system https://demo.s.360alumni.com/api/documentation
Your system https://<<your-system>>.360alumni.com/api/documentation

Filtering Campaign Results


The following steps walk you through using a filter parameter to get data on campaigns.

  1. Click the GET /api/campaigns/ method.
    Optional filter parameters include created_since and created_before. Use these parameters to narrow the campaigns returned to within a specific time frame. 

    GET-campaigns-Documentation.png

  2. Click Sandbox to display the form for entering values and trying the request.
    For this example we'll narrow the results to those campaigns created since August 1, 2017.

    1. Enter your API key in an HTTP request header.
    2. Enter the value 2017-08-01 for the created_since parameter.
    3. Click Try! to execute the API request. 

      GET-campaigns-filtered.png

  3. The Response Body shows the JSON results.
    Note the values for the createdAt field are more recent than the value input for created_since.

    GET-campaigns-filtered-Response.png

Filtering Donation Results


The following steps walk you through using filter parameters to get data on donations.

  1. Click the GET /api/donations/ method. Note the following:
    • Optional parameters to filter the results include campaign_id, user_id, start_date, and end_date

      GET-donations-Documentation.png

  2. Click Sandbox to display the form for entering values and trying requests.

  3. First we'll request all the donations.

    1. Enter your API key in an HTTP request header.
    2. Click Try! to execute the API request.

  4. The Response Body contains a JSON array of Donation Objects that includes all donations. The following image shows a few of these results. Note the following:
    • Donation object fields correspond to the filter parameters campaign_id and user_id for GET /api/donations/ requests.
    • The created_at field determines the results of a GET /api/donations/ request if you use the start_date or end_date filter parameters. 

      GET-donations-Response.png

  5. The next request filters donations by user_id.

    1. Enter 1102 for the user_id value.
    2. Click Try! to execute the API request. 

      GET-donations-Filtered-Request.png

  6. Note the results contain a few donation objects. 

    GET-donations-Filtered-Response.png

Filtering User Results


The following steps walk you through using filter parameters to get data on users.

  1. Click the GET /api/users/ method.

  2. Click Sandbox to display the form for entering values and trying requests.

  3. Note there are a great number of optional parameters available to filter the results.

    GET-users-Parameters.png

  4.  First we'll request all users that are not yet approved. 

    1. Enter your API key in an HTTP request header.
    2. Enter the value 0 for the approved field. A 1 represents approved and a 0 represents not approved.
    3. Click Try! to execute the API request.

  5. The Response Body contains a JSON array of user objects where the approved field value is 0.

  6. The next request filters for all approved users that are not enabled.

    1. Enter the value 1 for the approved field.
    2. Enter the value 0 for the enabled field. A 1 represents enabled accounts and a 0 represents accounts that are not enabled.
    3. Click Try! to execute the API request.

  7. Note the results contain fewer user records.

  8. Click a down arrow in the Response Body to collapse the view of an object's fields. 

    GET-users-Response.png