API de listagem das contas de email.
Exemplo de requisição
GET /api/email/accounts HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.email.get_accounts()
print(response.payload)
const response = await sdk.email.getAccounts();
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": 1,
"default": true,
"name": "Contas envio de certificados",
"email": "certs@itflex.com.br",
"service": "gmail",
"hash_auth": true,
"password": "certs",
"smtp_server": "smtp.test.com.br",
"smtp_port": 1000,
"smtp_crypt": "ssl-tls",
"smtp_auth_mechanism": "plain",
"created_at": "2018-12-13T12:20:02.932000+00:00",
"updated_at": "2018-12-13T12:20:02.932000+00:00"
},
]
[
Account(
id=1,
default=True,
name="Contas envio de certificados",
email="certs@itflex.com.br",
service="gmail",
hash_auth=True,
password="certs",
smtp_server="smtp.test.com.br",
smtp_port=1000,
smtp_crypt="ssl-tls",
smtp_auth_mechanism="plain",
created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
)
]
[
{
id: 1,
default: true,
name: "Contas envio de certificados",
email: "certs@itflex.com.br",
service: "gmail",
hashAuth: true,
password: "certs",
smtpServer: "smtp.test.com.br",
smtpPort: 1000,
smtpCrypt: "ssl-tls",
smtpAuthMechanism: "plain",
createdAt: "2018-12-13T12:20:02.000Z",
updatedAt: "2018-12-13T12:20:02.000Z"
}
];
API de consulta de conta de email
id
Exemplo de requisição
GET /api/email/accounts/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.email.types import GetAccountRequest
request = GetAccountRequest(id=1)
response = sdk.email.get_account(request)
print(response.payload)
const response = sdk.email.getAccount({ id: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"default": true,
"name": "Contas envio de certificados",
"email": "certs@itflex.com.br",
"service": "gmail",
"hash_auth": true,
"password": "certs",
"smtp_server": "smtp.test.com.br",
"smtp_port": 1000,
"smtp_crypt": "ssl-tls",
"smtp_auth_mechanism": "plain",
"created_at": "2018-12-13T12:20:02.932000+00:00",
"updated_at": "2018-12-13T12:20:02.932000+00:00"
}
Account(
id=1,
default=True,
name="Contas envio de certificados",
email="certs@itflex.com.br",
service="gmail",
hash_auth=True,
password="certs",
smtp_server="smtp.test.com.br",
smtp_port=1000,
smtp_crypt="ssl-tls",
smtp_auth_mechanism="plain",
created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
default: true,
name: "Contas envio de certificados",
email: "certs@itflex.com.br",
service: "gmail",
hashAuth: true,
password: "certs",
smtpServer: "smtp.test.com.br",
smtpPort: 1000,
smtpCrypt: "ssl-tls",
smtpAuthMechanism: "plain",
createdAt: "2018-12-13T12:20:02.000Z",
updatedAt: "2018-12-13T12:20:02.000Z"
}
API para criação de conta e email
Exemplo de requisição
POST /api/email/accounts HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"default": true,
"name": "Contas envio de certificados",
"email": "certs@itflex.com.br",
"service": "gmail",
"hash_auth": true,
"password": "certs",
"smtp_server": "smtp.test.com.br",
"smtp_port": 1000,
"smtp_crypt": "ssl-tls",
"smtp_auth_mechanism": "plain",
}
from itflex_sdk.email.types import CreateAccountRequest
request = CreateAccountRequest(
default=True,
name="Contas envio de certificados",
email="certs@itflex.com.br",
service="gmail",
hash_auth=True,
password="certs",
smtp_server="smtp.test.com.br",
smtp_port=1000,
smtp_crypt="ssl-tls",
smtp_auth_mechanism="plain",
)
response = sdk.email.create_account(request)
print(response.payload)
const response = await sdk.email.createAccount({
default: true,
name: "Contas envio de certificados",
email: "certs@itflex.com.br",
service: "gmail",
hashAuth: true,
password: "certs",
smtpServer: "smtp.test.com.br",
smtpPort: 1000,
smtpCrypt: "ssl-tls",
smtpAuthMechanism: "plain"
});
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"default": true,
"name": "Contas envio de certificados",
"email": "certs@itflex.com.br",
"service": "gmail",
"hash_auth": true,
"password": "certs",
"smtp_server": "smtp.test.com.br",
"smtp_port": 1000,
"smtp_crypt": "ssl-tls",
"smtp_auth_mechanism": "plain",
"created_at": "2018-12-13T12:20:02.932000+00:00",
"updated_at": "2018-12-13T12:20:02.932000+00:00"
}
Account(
id=1,
default=True,
name="Contas envio de certificados",
email="certs@itflex.com.br",
service="gmail",
hash_auth=True,
password="certs",
smtp_server="smtp.test.com.br",
smtp_port=1000,
smtp_crypt="ssl-tls",
smtp_auth_mechanism="plain",
created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
default: true,
name: "Contas envio de certificados",
email: "certs@itflex.com.br",
service: "gmail",
hashAuth: true,
password: "certs",
smtpServer: "smtp.test.com.br",
smtpPort: 1000,
smtpCrypt: "ssl-tls",
smtpAuthMechanism: "plain",
createdAt: "2018-12-13T12:20:02.000Z",
updatedAt: "2018-12-13T12:20:02.000Z"
}
API de edição de conta de email.
id
Exemplo de requisição
PUT /api/email/accounts/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"default": true,
"name": "Contas envio de certificados",
"email": "certs@itflex.com.br",
"service": "gmail",
"hash_auth": true,
"password": "certs",
"smtp_server": "smtp.test.com.br",
"smtp_port": 1000,
"smtp_crypt": "ssl-tls",
"smtp_auth_mechanism": "plain",
}
from itflex_sdk.email.types import UpdateAccountRequest
request = UpdateAccountRequest(
id=1,
default=True,
name="Contas envio de certificados",
email="certs@itflex.com.br",
service="gmail",
hash_auth=True,
password="certs",
smtp_server="smtp.test.com.br",
smtp_port=1000,
smtp_crypt="ssl-tls",
smtp_auth_mechanism="plain",
)
response = sdk.email.update_account(request)
print(response.payload)
const response = await sdk.email.updateAccount({
id: 1,
default: true,
name: "Contas envio de certificados",
email: "certs@itflex.com.br",
service: "gmail",
hashAuth: true,
password: "certs",
smtpServer: "smtp.test.com.br",
smtpPort: 1000,
smtpCrypt: "ssl-tls",
smtpAuthMechanism: "plain"
});
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"default": true,
"name": "Contas envio de certificados",
"email": "certs@itflex.com.br",
"service": "gmail",
"hash_auth": true,
"password": "certs",
"smtp_server": "smtp.test.com.br",
"smtp_port": 1000,
"smtp_crypt": "ssl-tls",
"smtp_auth_mechanism": "plain",
"created_at": "2018-12-13T12:20:02.000Z",
"updated_at": "2018-12-13T12:20:02.000Z"
}
Account(
id=1,
default=True,
name="Contas envio de certificados",
email="certs@itflex.com.br",
service="gmail",
hash_auth=True,
password="certs",
smtp_server="smtp.test.com.br",
smtp_port=1000,
smtp_crypt="ssl-tls",
smtp_auth_mechanism="plain",
created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
default: true,
name: "Contas envio de certificados",
email: "certs@itflex.com.br",
service: "gmail",
hashAuth: true,
password: "certs",
smtpServer: "smtp.test.com.br",
smtpPort: 1000,
smtpCrypt: "ssl-tls",
smtpAuthMechanism: "plain",
createdAt: "2018-12-13T12:20:02.000Z",
updatedAt: "2018-12-13T12:20:02.000Z"
}
API de deleção de conta de email.
id
Exemplo de requisição
DELETE /api/email/accounts/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.email.types import DeleteAccountRequest
request = DeleteAccountRequest(id=1)
response = sdk.email.delete_account(request)
print(response.success)
const response = await sdk.email.deleteAccount({ id: 1 });
console.log(response.success);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
True
true;
API para testa envio de email
Exemplo de requisição
POST /api/email/accounts/test HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"default": true,
"name": "Contas envio de certificados",
"email": "certs@itflex.com.br",
"service": "gmail",
"hash_auth": true,
"password": "certs",
"smtp_server": "smtp.test.com.br",
"smtp_port": 1000,
"smtp_crypt": "ssl-tls",
"smtp_auth_mechanism": "plain",
"to_email": "test@test.com",
}
from itflex_sdk.email.types import TestAccountRequest
request = TestAccountRequest(
default=True,
name="Contas envio de certificados",
email="certs@itflex.com.br",
service="gmail",
hash_auth=True,
password="certs",
smtp_server="smtp.test.com.br",
smtp_port=1000,
smtp_crypt="ssl-tls",
smtp_auth_mechanism="plain",
to_email="test@test.com"
)
response = sdk.email.teste_account(request)
print(response.payload)
const response = await sdk.email.testAccount({
default: true,
name: "Contas envio de certificados",
email: "certs@itflex.com.br",
service: "gmail",
hashAuth: true,
password: "certs",
smtpServer: "smtp.test.com.br",
smtpPort: 1000,
smtpCrypt: "ssl-tls",
smtpAuthMechanism: "plain",
toEmail="test@test.com"
});
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Resposta
Campo | Descrição |
---|---|
id | int Identificador da conta de email |
default | booleanrequerido Flag se a conta de email é a conta padrão do sistema |
name | stringrequerido Nome da conta de email |
stringrequerido Email da conta |
|
service | stringrequerido Tipo de serviço de email que deve ser utilizado Valores possíveis:
|
has_auth | booleanrequerido Flag se a conta tem autenticação |
password | string Senha de usuário de autenticação no servidor email |
smtp_server | string Endereço do servidor SMTP para envio de emails |
smtp_crypt | string Tipo de criptografia do servidor de envio de email Valores possíveis:
|
smtp_auth_mechanism | string Mecanismo de autenticação por usuário e senha do servidor de envio de email. Valores possíveis:
|