跃然一笑
您必须先在Autentique上创建一个帐户和一个 API 密钥。在沙盒中上传文件并将其发送到电子邮件进行签名。它返回文档的 ID 和名称。使用卷曲 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>使用 aiogqlchttps://github.com/DoctorJohn/aiogqlcimport asynciofrom aiogqlc import GraphQLClientendpoint = "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