Вы должны сначала создать учетную запись на Autentique и ключ API.
Загрузите файл в песочницу и отправьте его на электронную почту для подписи. Он возвращает идентификатор и имя документа.
Использование curl
curl -H "Authorization: Bearer <TOKEN>" https://api.autentique.com.br/v2/graphql \
-F operations='{"query": "mutation CreateDocumentMutation($document: DocumentInput! $signers: [SignerInput!]! $file: Upload!) {createDocument(sandbox: true, document: $document, signers: $signers, file: $file) {id name }}", "variables": { "document": {"name": "<DOCUMENT_NAME>"}, "signers": [{"email": "<FROM_EMAIL>","action": "SIGN"}], "file": null } }' \
-F map='{ "0": ["variables.file"] }' \
-F 0=@<FULL_PATH_FILE>
Использование aiogql c
https://github.com/DoctorJohn/aiogqlc
import asyncio
from aiogqlc import GraphQLClient
endpoint = "https://api.autentique.com.br/v2/graphql"
headers = {
"Authorization": "Bearer <TOKEN>"
}
client = GraphQLClient(endpoint, headers=headers)
async def create_document():
query = """
mutation CreateDocumentMutation(
$document: DocumentInput!
$signers: [SignerInput!]!
$file: Upload!
) {
createDocument(
sandbox: true,
document: $document,
signers: $signers,
file: $file)
{
id
name
}
}"""
variables = {
"document": {
"name": "<DOCUMENT_NAME>"
},
"signers": [{
"email": "<FROM_EMAIL>",
"action": "SIGN"
}],
"file": open('<FULL_PATH_FILE>', 'rb'),
}
response = await client.execute(query, variables=variables)
print(await response.json())
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(create_document())
Для реализации на других языках: https://github.com/jaydenseric/graphql-multipart-request-spec#implementations