NextRequest API: V2

NextRequest API - V2.0

Our API (Application Programming Interface) endpoints respond to http requests with JSON. To access to the API, you will need to request a token by emailing support@nextrequest.com. The API is now paginated, returning a maximum of 100 requests per request.

Table of Contents

Making Requests

You can make requests to the NextRequest API via

  • Postman
  • cURL
  • Your custom app

Requests in Chrome with Postman

  1. Open Chrome
  2. Install the Postman Chrome extension and launch
  3. You don’t need to register, just click “Skip this, go straight to the app” when you get to this pageScreen_Shot_2019-07-11_at_1.19.54_PM.png
  4. Fill in ‘Enter request url’ with http://YOUR_SITE/api/v2/requests (replacing the YOUR_SITE with your NextRequest domain name).
  5. Click on ‘Headers’ and fill in ‘key’ with Authorization and ‘value’ with YOUR_TOKEN (that we have provided).
  6. Your request should look like this:Screen_Shot_2019-07-11_at_1.30.07_PM.png
  7. Click the Send button. The response will be appear in the lower part of the screen.

Requests in the Terminal Using cURL

  1. Open your terminal
  2. Type in the following, replacing “YOUR_SITE” with your NextRequest domain (e.g. portofseattle.nextrequest.com) and “YOUR_TOKEN” with the token we have provided and v1 with v2. Screen_Shot_2019-07-11_at_2.43.19_PM.png(On windows, the curl command must not contain single quotes. Use double quotes instead
  3. Press Enter/Return, and the first 100 requests will appear in the terminal.

Your Custom App

You are welcome to tailor your app to consume the NextRequest API. There are simple open-source Ruby solutions to consume APIs, such as REST client and Faraday.

Pagination

You can scroll through the database by using pagination. The default will return the first page with 100 items. There are two attributes you can set:

  • page[size]
    • Defaults to the maximum value (100)
    • Allows any integer up to the 100
  • page[number]
    • Defaults to 1
    • Allow any integer
    • If the request includes no items, the response will be an empty array ([]) or a hash whose data key has a value of an empty array (i.e JSON.parse(response)["data"] == [] is true).

Example:

https://YOUR_SITE/api/v2/helper_requests.json?page[size]=2&page[number]=3

This would return the 3rd page of helper_requests with a page size of 2.

Date ranges

You can limit results by the date created using the query parameters "start_date" and "end_date". These should be in month/day/year format (e.g. 2/23/2018).

  • start_date
    • the first date you'd like included in the query
    • starts at the beginning of the day
  • end_date
    • the last date you'd like included in the query
    • ends at the end of the day

These can be used together or separately. All of the following are valid:

Response Structure

Requests

GET /requests

Example response:
[

{

"id": 30,

"created_at": "2015-01-12T20:48:10.600-07:00",

"updated_at": "2018-06-05T08:55:53.805-06:00",

"request_text": "test",

"request_date": "2015-01-12T20:48:10.600-07:00",

"due_date": "2015-01-27T20:48:10.000-07:00",

"closed_date": null,

"request_submit_type_id": null,

"pretty_id": "15-3",

"publish_date": "2015-01-12T20:48:10.600-07:00",

"visibility": "published",

"closure_reasons": null,

"state": "Overdue",

"staff_cost": "0.0",

"initial_contact_date": null,

"initial_contact_event_id": null,

"compliance": false,

"initial_due_date": null,

"poc_id": 124,

"expiration_date": null,

"expire_next_month": false,

"archived": false,

"exempt_from_retention": false,

"account_id": 22,

"pretty_id_group_id": 7,

"anticipated_fulfilled_at": null,

"demo": false,

"jlarc_response_biz_days": 44,

"biz_days_to_close": null,

"days_to_close": null,

"general_report_response_days": null,

"ever_overdue": false,

"bdp_used": false

}

]

Messages (Notes)

GET /notes



Example response:
[

{

"id": 632,

"note_text": "Email with attachment from staff",

"created_at": "2018-06-28T13:05:44.759-06:00",

"updated_at": "2018-06-28T13:05:44.759-06:00",

"request_id": 748,

"email": true,

"deleted": false,

"user_id": 1964,

"state": "staff",

"account_id": 22

}

]

Request Close Reasons

GET /request_close_reasons



Example response:
[

{

"id": 1,

"request_id": 2,

"close_request_type_id": 1,

"created_at": "2014-12-02T16:41:14.515-06:00",

"updated_at": "2016-05-15T09:46:29.604-05:00",

"request_event_id": 9,

"description": "<p>Fulfilled</p>\n",

"account_id": 22

}

]

Request Events

GET /request_events



Example response:
[

{

"id": 112,

"request_id": 28,

"event_type_id": 1159,

"subject_user_id": 97,

"object_user_id": 97,

"description": null,

"created_at": "2014-11-24T15:08:40.050-07:00",

"updated_at": "2014-11-24T15:08:40.050-07:00",

"display_text": null,

"byline": "by andy+requester@example.com",

"public_byline": null,

"state": "public",

"account_id": 22,

"deleted": false

}

]



Event Types

GET /event_types



Example response:
[

{

"id": 1152,

"name": "Request Closed",

"created_at": "2014-11-24T14:21:31.201-07:00",

"updated_at": "2017-05-15T13:32:00.658-06:00",

"state": "public",

"display_on_request_timeline": true,

"display_name": null,

"icon_class": "far fa-check-square",

"toggleable": false,

"category": "status",

"account_id": 22

}

]




Staff Time (Request Hours)

GET /request_hours



Example response:
[

{

"id": 2,

"user_id": 112,

"request_id": 73,

"seconds": 8280,

"staff_cost": "0.0",

"created_at": "2016-06-30T15:45:48.636-06:00",

"updated_at": "2016-06-30T15:45:48.648-06:00",

"deleted": false,

"description": null,

"department_id": null,

"account_id": 22

}

]




Request Support Staff (Helper Requests)

GET /helper_requests



Example response:
[

{

"user_id": 2,

"request_id": 1,

"created_at": "2015-03-22T10:54:16.926-05:00",

"updated_at": "2015-03-22T10:54:16.926-05:00",

"id": 1,

"deleted": false,

"account_id": 22

}

]

Tags

GET /tags



Example response:
[

{

"id": 6,

"name": "Redaction Done",

"description": "",

"created_at": "2016-10-26T17:36:15.837-06:00",

"updated_at": "2018-07-11T11:38:29.176-06:00",

"account_id": 22,

"disabled": true,

"demo": false,

"category_id": null

}

]




Taggings

GET /taggings



Example response:
[

{

"id": 1,

"tag_id": 1,

"taggable_id": 344,

"taggable_type": "Request",

"created_at": "2016-08-21T13:17:40.254-05:00",

"updated_at": "2016-08-21T13:17:40.254-05:00",

"deleted": false,

"account_id" : 22

}

]



Documents

GET /documents



Example response:
[

{

"id": 2168,

"title": "image001.jpg",

"url": "//rtdev.s3-us-west-1.amazonaws.com/test/17-119/2b044e1f-0dde-4208-bb50-6e1c490b46d7",

"description": "",

"created_at": "2018-03-19T16:40:23.651-06:00",

"updated_at": "2018-07-05T16:39:34.727-06:00",

"count": 0,

"doc_date": null,

"redacted_at": null,

"deleted": false,

"link": false,

"requester_upload": false,

"folder": "RE: Attorney Client RE: Draft Response for MC(1)",

"state": "staff",

"filename": "image001.jpg",

"request_id": 466,

"archived": false,

"expiration_date": "2020-03-19T16:40:23.651-06:00",

"expire_next_month": false,

"exempt_from_retention": false,

"subfolder": null,

"review_state": "Unprocessed",

"account_id": 22,

"token": null,

"token_expires_at": null,

"demo": false,

"attachment_via_email": false,

"temp_upload_key": null,

"original_doc_link": null

}

]



Departments

GET /departments



Example response:
[

{

"id": 67,

"name": "Parks & Recreation",

"description": "",

"created_at": "2018-04-23T13:49:15.497-06:00",

"updated_at": "2019-01-29T07:23:16.471-07:00",

"poc_id": null,

"visibility_default": null,

"disabled": false,

"account_id": 22,

"public_visibility": false,

"demo": false

}

]




Department Users

GET /department_users



Example response:
[

{

"id": 2,

"department_id": 1,

"user_id": 6,

"created_at": "2015-01-19T16:47:58.039-06:00",

"updated_at": "2015-01-19T16:47:58.053-06:00",

"default_helper": false,

"deleted": false,

"account_id": 22

}

]



Departments’ Requests

GET /departments_requests



Example response:
[

{

"request_id": 144,

"department_id": 2,

"id": 1,

"deleted": false,

"account_id": 22

}

]

Users

GET /users



Example response:
[

{

"id": 2287,

"email": "samantha@nextrequest.com",

"reset_password_sent_at": null,

"remember_created_at": null,

"sign_in_count": 1,

"current_sign_in_at": "2019-01-17T10:46:34.807-07:00",

"last_sign_in_at": "2019-01-17T10:46:34.807-07:00",

"current_sign_in_ip": "127.0.0.1",

"last_sign_in_ip": "127.0.0.1",

"created_at": "2019-01-17T10:43:50.656-07:00",

"updated_at": "2019-01-17T10:46:34.860-07:00",

"name": null,

"phone_number": null,

"address": null,

"company": null,

"disabled": false,

"role": "admin",

"city": null,

"state": null,

"zipcode": null,

"default_helper": false,

"title": null,

"hourly_rate": null,

"undeliverable_email": false,

"password_setup": true,

"confirmed_at": "2019-01-17T10:46:32.799-07:00",

"confirmation_sent_at": null

}

]




Message Templates

GET /message_templates



Example response:
[

{

"id": 5,

"name": "Sally's template",

"description": "<p>hi</p>",

"created_at": "2016-08-03T14:23:13.530-06:00",

"updated_at": "2018-07-27T09:13:16.826-06:00",

"initial_contact": false,

"account_id": 22,

"disabled": true,

"demo": false,

"category_id": null

}

]



Message Template Usage

GET /notes_message_templates



Example response:
[

{

"id": 1,

"note_id": 535,

"message_template_id": 2,

"account_id": 22,

"created_at": "2018-02-15T16:19:50.891-07:00",

"updated_at": "2018-02-15T16:19:50.895-07:00"

}

]