API Resources

Prev Next

Our API endpoints respond to HTTP requests that use JSON and can provide data for custom reports.

Prerequisites

  • Please contact Support to initiate the API key request.

  • Your user role must be Admin to request and access the API key.

  • The API key is assigned to only one user. They must be logged in to the portal in order to access and make requests.

  • NextRequest cannot assist with API requests/calls or troubleshooting. The customer is fully responsible for these functions.

Make Requests

You can make requests to the NextRequest API using:

  • Postman

  • cURL (Client for URL)

  • Your custom app

Postman Requests in Chrome

  1. Open Chrome and install the Postman Chrome extension

  2. Click the Skip this, go straight to the app link The 'Skip this and go straight to app' link below the sign in fields.

  3. Fill in Enter request URL with http://YOUR_SITE/api/v2/requests (replace the YOUR_SITE with your NextRequest domain name) The URL field next to the GET dropdown.

  4. Click on Headers and add Authorization as the key and YOUR_TOKEN as the value (that we have provided) Enter authorization key and token value.

  5. Click the Send button. The response will appear in the lower part of the screen. The blue, rectangular Send button next to the request URL.

cURL Requests in the Terminal

  1. Open your terminal

  2. Type in the following and replace "YOUR_SITE" with your NextRequest domain (example: portofseattle.nextrequest.com) and "YOUR_TOKEN" with the token we have provided

    • $ curl YOUR_SITE/api/v2/requests -H 'Authorization: Your_Token'

  3. Press Enter 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

The API is now paginated and returns a maximum of 100 requests per request. You can use pagination to scroll through the database. The default will return 100 items on the first page. 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 (such as, JSON.parse(response)["data"] == [] is true).

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

The 3rd page of helper_requests will return a page size of 2.

Date Ranges

Use the query parameters "start_date" and "end_date" to limit results by the date created. These should be in month/day/year format (example: 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:

  • https://YOUR_SITE/api/v2/tags.json?start_date=1/14/2018

  • https://YOUR_SITE/api/v2/tags.json?start_date=1/14/2018&end_date=1/25/2018

  • https://YOUR_SITE/api/v2/tags.json?end_date=1/14/2018

Example Responses

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": "

Fulfilled

\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 [email protected]",

"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": "[email protected]",

"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": "

hi

",

"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"

}

]