API: Mail
POST /api/v3/mail
Request parameter:
No Request parameter
JSON data:
Parameter | Mandatory | In Type | Example | Description |
---|---|---|---|---|
ref_id | false | string | k123km12d12dk1 | If provided return value will contain it along with send-result for easy identification |
to | true | string | contact@wmc.ch | List of to addresses or a single email address |
cc | false | string | - as above - | List of carbon copy target email addresses |
bcc | false | string | - as above - | List of blind carbon copy target email addresses |
subject | true | string | Invoice for [HK_Name] | Email subject - it can contain tokens from the BrokerStar writer module (You need to provide contact , policy , claim or premium_invoice parameter to use tokens) |
body | true if not using template parameter | string | Hello [HK_Name] <br/> <hr/> Best regards, | Email body - as above - |
template | false | int | 2 | If was want to use API: Mail Templates instead of the `body` parameter. |
contact | false | int | 1 | Used to replace tokens in email body/subject based on the provided API: Contact |
policy | false | int | 12 | Used to replace tokens in email body/subject based on provided API: Policy |
claim | false | int | 123 | Used to replace tokens in email body/subject based on a provided API: Claim |
premium_invoice | false | int | 1234 | Used to replace tokens in email body/subject based on provided API: Premium Invoice |
save | false | boolean | false | Default=true, If true mail will be stored in BrokerStar Mail system (as system email) |
API: _ Default behavior #List defaults
Response data:
Metadata: object.
Parameter | Type | Description |
---|---|---|
status | int | Response status (same as in http code) |
Data: object.data[array]
Parameter | Type | Description |
---|---|---|
code | int | Response code (for single email send) |
subject | string | Filled subject field |
body | string | Filled body field |
Response (Error):
Parameter | Type | Description |
---|---|---|
code | integer | An error code |
error | string | A message containing some information about the error |
errors | array | List of errors devided by field in associative array {field_name:error message} |
API: _ Default behavior#Authentication defaults
Request
curl -X POST https://public.brokerstar.biz/api/v3/mail --data-raw '{ "subject":"Invoice for [HK_Name]", "to":"contact@wmc.ch;service@wmc.ch", "template":3, "contact": 1, "ref_id": "1aa1241das12" } --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'
Response (Success)
200 OK { "status": 200, "data": { "code": 200, "subject": "Invoice for WMC IT Solutions AG", "body": "<div>asdas </div>", "ref_id": "1aa1241das12" } }
Response (Error)
200 OK { "status": 200, "data": { "error": "Missing argument (subject)XXX:\n This value is not a valid email address. \nMissing argument (body)", "errors": { "subject": "This argument is required", "to": "XXX:\n This value is not a valid email address. \n", "body": "This argument is required (if not template provided)" }, "error_count": 3, "ref_id": "1aa1241das12" } }
Or one of
- API: _ Default behavior #Authentication defaults
- API: _ Default behavior #List defaults
POST /api/v3/mail
Request parameter:
No Request parameter
JSON data:
Parameter | Mandatory | In Type | Example | Description |
---|---|---|---|---|
Same as in single email bug in array [{obejct},{object}] |
API: _ Default behavior #List defaults
Response data:
Metadata: object.
Parameter | Type | Description |
---|---|---|
status | int | Response status (same as in http code) |
send | int | Number of send emails |
error | int | Number of not send emails |
Data: object.data[array]
Parameter | Type | Description |
---|---|---|
Same as in single email bug in array [{obejct},{object}] |
Response (Error):
Parameter | Type | Description |
---|---|---|
Same as in single email bug in array [{obejct},{object}] |
API: _ Default behavior #Authentication defaults
Request
curl -X POST https://public.brokerstar.biz/api/v3/mail --data-raw '[ { "subject":"Invoice for [HK_Name]", "template": 1, "ref_id": "asdasdas1312", "to" : "asd@asd.pl;kkk@wp.pla", "contact" : 123 }, { "subject":"123123", "body": "hello: [HK_Adressblock]", "ref_id": "asdasdas1313", "to" : "sss@asd.pl", "contact" : 123 }, { "to":"dsaxa@gmail.com", "save": false } ]' --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'
Response (Mixed)
200 OK { "send": 2, "error": 1, "data": [ { "code": 200, "subject": "Invoice for Hypoteq AG", "body": "<div>asdasdas asd as Hypoteq AG<br/>Industriestrasse 47<br/>6300 Zug</div>", "ref_id": "asdasdas1312" }, { "code": 200, "subject": "123123", "body": "hello: Hypoteq AG<br/>Industriestrasse 47<br/>6300 Zug", "ref_id": "asdasdas1313" }, { "error": "Missing argument (subject)Missing argument (body)", "errors": { "subject": "This argument is required", "body": "This argument is required (if not template provided)" }, "error_count": 2 } ] }
Response (Error)
Or one of
- API: _ Default behavior #Authentication defaults
- API: _ Default behavior #List defaults