REST API: Notes & Attachments
Using the REST API, you can create notes and attachments within your AMS+ account. For auditing purposes, you may not update or delete notes or attachments in AMS+ via API.
Note & Attachment Resources
Create
RESOURCE URL
https://app.agencybloc.com/api/v1/notes/create
REQUIRED POST PARAMETERS
You must POST the following parameters via the body of the request. Parameters found in the querystring of the request will be ignored:
Parameter | Description |
---|---|
entity_id | The ID of the entity (agent, group, individual, or policy) the note/attachment will be created under. |
entity_type | The entity type you are attaching the note/attachment to. |
The entityType parameter must be one of the following values:
- Agent
- Group
- Individual
- Policy
ADDITIONAL POST PARAMETERS
For each note/attachment record (“collection”), a note body and note subject are required.
Along with each note, you can also post up to 5 files (optional). For each file within a collection, a filename must be supplied as well as a valid URL or base64 encoded file. You may post up to 5 Notes/Attachment collections, with each one containing up to 5 files.
See the Examples section at the end for text files with demo data.
Parameter | Description | Parameter Collection |
---|---|---|
attachment_note_1_body_text | Note body - Appears in the detail view of a note entry. Must not exceed 4,294,977,295 bytes. | 1 |
attachment_note_1_subject_text | Note subject - Appears in note lists for entities in the web app. Must not exceed 65,535 bytes. | 1 |
attachment_note_1_pinned | Flag indicating whether this item will be pinned. Any other previously pinned notes will become un-pinned. Must be either a 1 or a 0. Any other value will be treated as a 0. | 1 |
attach_file_to_note_1 | Flag indicating whether this note will have file attachments. Must be either a 1 or a 0. Any other value will be treated as a 0. | 1 |
attachment_note_1_file_url_1 | A valid URL where a file attachment can be downloaded from. When provided, we download the file and attach to the note entry. Must start with “http://” or “https://”. Anything else will be ignored. | 1 |
attachment_note_1_file_body_1 | The file contents as a base64 encoded string. Any non-empty, base64 encoding that is invalid will not be accepted and the file will not be attached. | 1 |
attachment_note_1_file_name_1 |
The filename of the uploaded file. Invalid characters in the filename may be replaced and filenames may be shortened under certain conditions. Invalid characters include:
|
1 |
attachment_note_1_file_url_2 | A valid URL where a file attachment can be downloaded from. When provided, we download the file and attach to the note entry. Must start with “http://” or “https://”. Anything else will be ignored. | 1 |
attachment_note_1_file_body_2 | The file contents as a base64 encoded string. Any non-empty, base64 encoding that is invalid will not be accepted and the file will not be attached. | 1 |
attachment_note_1_file_name_2 |
The filename of the uploaded file. Invalid characters in the filename may be replaced and filenames may be shortened under certain conditions. Invalid characters include:
|
1 |
... | ... | ... |
attachment_note_1_file_url_5 | A valid URL where a file attachment can be downloaded from. When supplied, we download the file and attach to the note entry. Must start with “http://” or “https://”. Anything else will be ignored. | |
attachment_note_1_file_body_5 | The file contents as a base64 encoded string. Any non-empty, base64 encoding that is invalid will not be accepted and the file will not be attached. | 1 |
attachment_note_1_file_name_5 |
The filename of the uploaded file. Invalid characters in the filename may be replaced and filenames may be shortened under certain conditions. Invalid characters include:
|
1 |
attachment_note_2_body_text | Note body - Appears in the detail view of a note entry. Must not exceed 4,294,977,295 bytes. | 1 |
attachment_note_2_subject_text | Note subject - Appears in note lists for entities in the web app. Must not exceed 65,535 bytes. | 1 |
attachment_note_2_pinned | Flag indicating whether this item will be pinned. Any other previously pinned notes will become un-pinned. Must be either 1 or 0. Any other value will be treated as a 0. | 1 |
attach_file_to_note_2 | Flag indicating whether this note will have file attachments. Must be either 1 or 0, any other value will be treated as a 0. | 1 |
attachment_note_2_file_url_1 | A valid URL where a file attachment can be downloaded from. When supplied, we download the file and attach to the note entry. Must start with “http://” or “https://”. Anything else will be ignored. | 1 |
attachment_note_2_file_body_1 | The file contents as a base64 encoded string. Any non-empty, base64 encoding that is invalid will not be accepted and the file will not be attached. | 1 |
attachment_note_2_file_name_1 |
The filename of the uploaded file. Invalid characters in the filename may be replaced and filenames may be shortened under certain conditions. Invalid characters include:
|
1 |
... | ... | ... |
attachment_note_5_file_body_5 | The file contents as a base64 encoded string. Any non-empty, base64 encoding that is invalid will not be accepted and the file will not be attached. | 1 |
attachment_note_5_file_name_5 |
The filename of the uploaded file. Invalid characters in the filename may be replaced and filenames may be shortened under certain conditions. Invalid characters include:
|
1 |
RESPONSE
A return response will be generated after you have consumed the API. Upon successfully creating a new note inside your AMS+ account, you will get a return status of 200 along with the noteID as seen below.
{
"Agencybloc Response": {
"Status":"200",
"note_ids":[123456],
"Action":"create"
}
Exception Responses
The exception responses will include status, title, and message and be in JSON format.
{ "Agencybloc Response": { "Exception": { "Status":"Status Code", "Title":"Title of Error", "Message":"Error Message" } } }
List
RESOURCE URL
https://app.agencybloc.com/api/v1/notes/list
REQUIRED POST PARAMETERS
Returns a JSON list of note & attachment objects. Notes are ordered by modification date, newest to oldest, with the contained attachments ordered by filename.
Parameter | Description |
---|---|
entity_ID | The ID of the entity (agent, group, individual, or policy) the note/attachment will be created under. |
entity_Type | The entity type you are attaching the note/attachment to. |
RESPONSE
A return response will be generated after you have consumed the API. Upon successfully creating a new note inside your AMS+ account, you will get a return status of 200 along with the noteID as seen below.
{ "Agencybloc Response": { "Status":"200", "notes": [ { "note_id":1, "body_text":"Not Pinned - No attachments", "create_datetime":"7/9/2018 11:10:22 AM", "create_username":"John Doe", "update_datetime":"7/9/2018 11:10:22 AM", "update_username":"John Doe", "subject_text":"Note Number 2 - Not Pinned", "pinned":"0", "Attachments":[] }, { "note_id":2, "body_text":"Pinned Note", "create_datetime":"7/9/2018 11:09:59 AM", "create_username":"John Doe", "update_datetime":"7/9/2018 11:09:59 AM", "update_username":"John Doe", "subject_text":"Note Number 1 - Pinned", "pinned":"1", "Attachments": [ { "file_name":"Bagel.png", "file_url":"Download.aspx?f=61507_bagel.png\u0026type=7" } ] } ], "Action":"list" } }
Exception Responses
The exception responses will include status, title, and message and be in JSON format.
{ "Agencybloc Response": { "Exception": { "Status":"Status Code", "Title":"Title of Error", "Message":"Error Message" } } }
Examples
The attached files demonstrate the naming conventions for a single note with a single attached file (minimum functional implementation of notes & attachments) and 5 five notes with 5 attached files per note (25 files, maximum functional implementation at this time).
Note: The parameters in the text files are not URL encoded for readability purposes. Depending on your API endpoint or integration you may need to include additional parameters to complete your request.