Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
protogrid:api_endpoints [2021-09-15 20:39] – [/api/v2/apps/<app_name>/protos/<proto_key>/card-keys] dru | protogrid:api_endpoints [2021-12-14 04:03] – [/api/v2/apps/<app_name>/mailsend] dru | ||
---|---|---|---|
Line 143: | Line 143: | ||
* Example: limit=15 | * Example: limit=15 | ||
* Default value: 10 | * Default value: 10 | ||
- | * descending: If set to true the results will be in descending order. | + | * descending: If set to true the results will be in descending order. If set to true start_key and end_key must be exchanged. |
* Example: descending=true | * Example: descending=true | ||
* Default value: False | * Default value: False | ||
Line 152: | Line 152: | ||
| | ||
- | Note: you may only use either keys or start_key and end_key. | + | Please note: |
+ | * You may only use either | ||
+ | * Key values must be cut off after 300 characters (e. g. string values and sortstrings) because these values are also cut off in the view index. | ||
Details: For more details about the URL parameters see the [[http:// | Details: For more details about the URL parameters see the [[http:// | ||
Line 178: | Line 180: | ||
" | " | ||
" | " | ||
- | {" | + | {" |
{…} | {…} | ||
] | ] | ||
Line 349: | Line 351: | ||
The following URL parameter can be used for paging: | The following URL parameter can be used for paging: | ||
- | * card_key: Passing a card_key will give you a result starting from that key | ||
* limit: Defines how many proto keys are returned. Takes a number between 1 and 1000, default is 10. | * limit: Defines how many proto keys are returned. Takes a number between 1 and 1000, default is 10. | ||
- | The returned result contains a key " | + | The returned result contains a key " |
Example request: | Example request: | ||
< | < | ||
- | https:// | + | https:// |
</ | </ | ||
Line 366: | Line 367: | ||
" | " | ||
" | " | ||
- | {" | + | {" |
] | ] | ||
} | } | ||
Line 455: | Line 456: | ||
==== / | ==== / | ||
- | [POST] Send an email using the provided data | + | [POST] Send an email |
- | The following JSON data fields or URL parameters can be used: | + | To be able to use this endpoint, the SMTP mail server of your organization must first be configured as the designated mail relay server |
- | * to: TO address (multiple addresses separated by comma) | + | |
- | * cc: CC address (multiple addresses separated by comma) | + | |
- | * bcc: BCC address (multiple addresses separated by comma) | + | |
- | * replyto: ReplyTo address | + | |
- | * subject: Subject | + | |
- | * body: Body text in plain text format (URL encoded) | + | |
- | * bodyhtml: Body text in HTML format (URL encoded). If both body and bodyhtml are specififed, only bodyhtml will be used | + | |
- | Combinations of JSON data fields | + | Protogrid will fist try to establish a TLS session to the specified mail relay server |
- | The mail will be sent according to the currently logged in user (mail address specified in user profile, and the fields "SMTP Server Hostname", | + | The mail will be sent according to the currently logged in user (mail address specified in user profile and the field "SMTP Server Password" |
- | The function will fist try to establish a TLS session to the specified mail server and authenticate | + | The following JSON data fields can be used: |
+ | * to: TO addresses (Array of Strings, mandatory) | ||
+ | * cc: CC addresses (Array of Strings) | ||
+ | * bcc: BCC addresses (Array of Strings) | ||
+ | * reply_to: ReplyTo addresses (Array of Strings) | ||
+ | * from: From address if other than logged in user (String) | ||
+ | * subject: Subject (String, mandatory) | ||
+ | * body_text_plain: | ||
+ | * body_text_html: | ||
+ | * inline_images: | ||
+ | * attachments: | ||
- | The returned result will include | + | Attachments and inline images must already reside inside Protogrid, each attached to a Card. The logged in user must have read access to this Card(s). Attachments and inline images are specified |
- | + | <code javascript> | |
- | + | { | |
- | Example client-side jQuery request | + | "card_id" |
- | <code javascript > | + | "file_name" |
- | $.post({ | + | } |
- | | + | |
- | }).done(function (response) { | + | |
- | | + | |
- | }); | + | |
</ | </ | ||
+ | By default, users can send a mail to up to 10 recipients. This limit can be increased via the roles assigned to the users using the field " | ||
- | Example client-side jQuery request | + | The returned result will include a success message or details about the particular error. |
+ | |||
+ | Example client-side jQuery request: | ||
<code javascript> | <code javascript> | ||
$.post({ | $.post({ | ||
url: " | url: " | ||
data: JSON.stringify({ | data: JSON.stringify({ | ||
- | " | + | |
- | " | + | " |
- | " | + | " |
- | "replyto": "user4@example.com", | + | "reply_to": |
- | " | + | " |
- | "body": "This%20is%20a%20testmessage", | + | " |
- | }), | + | "body_text_plain": " |
+ | " | ||
+ | " | ||
+ | {" | ||
+ | ], | ||
+ | " | ||
+ | {" | ||
+ | ] | ||
+ | | ||
contentType: | contentType: | ||
}).done(function (response) { | }).done(function (response) { | ||
Line 503: | Line 514: | ||
</ | </ | ||
+ | As a response you receive a JSON with the following structure: | ||
+ | * errors [Array]: Contains information if no single email could be sent, otherwise it is empty. | ||
+ | * messages [Array]: Contains information if Protogrid could not establish the connection to the mail server with the most secure transport encryption, otherwise it is empty. | ||
+ | * result [Object]: Contains information regarding individual recipients to whom the email could not be delivered. If the email could be delivered to all recipients equals to { " | ||
- | Example | + | Example |
<code javascript> | <code javascript> | ||
{ | { | ||
- | " | + | |
- | | + | "messages": |
- | | + | [ |
+ | | ||
+ | " | ||
+ | ], | ||
+ | | ||
+ | | ||
+ | | ||
+ | [ | ||
+ | 554, | ||
+ | "5.7.1 < | ||
+ | ] | ||
+ | | ||
} | } | ||
</ | </ |