{"_id":"54dbad189f8ef11900f4df66","__v":87,"parentDoc":null,"project":"54da5d2f5b80b62300dadc4e","version":{"_id":"54da5d305b80b62300dadc51","project":"54da5d2f5b80b62300dadc4e","__v":7,"createdAt":"2015-02-10T19:34:08.062Z","releaseDate":"2015-02-10T19:34:08.062Z","categories":["54da5d305b80b62300dadc52","54da704b11dfeb1900430309","54da705c44b1090d00072b34","54db48c86db3861700c840c5","54db48cd7dadb32300511364","54dbaa0c7dadb3230051143b","572b89f0b352ab0e003daca2"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"v1.0","version_clean":"1.0.0","version":"1"},"category":{"_id":"54db48c86db3861700c840c5","__v":13,"version":"54da5d305b80b62300dadc51","pages":["54db4c2c7dadb3230051136b","54db4f1c74dfff3700f161d9","54db53fdeb78f13900cf108e","54db65ec1a14312100313971","54dbad189f8ef11900f4df66","54dbccb800add623007578b4","54ff74002882a10d00546966","55de2abb9067202b00ddfffb","55e4d19fe252ac0d00303a73","5654c2d82308e12b00a14add","56980f9c080e0c0d00a835dc","569810e0895fd40d00d4b2f8","56e30b3051857d0e008e77a1"],"project":"54da5d2f5b80b62300dadc4e","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-11T12:19:20.398Z","from_sync":false,"order":0,"slug":"rest-api","title":"Rest API"},"githubsync":"","user":"54da5cb85b80b62300dadc4b","metadata":{"title":"","description":"","image":[]},"updates":["5592a6f0a387cd2f0077ac11"],"next":{"pages":[],"description":""},"createdAt":"2015-02-11T19:27:20.292Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"[block:callout]\n{\n  \"type\": \"danger\",\n  \"body\": \"Sugerimos que você utilize a nova plataforma da Clicksign. Consulte a documentação da API em https://developers.clicksign.com. \\n\\nEsta documentação é referente à API da plataforma Clicksign Classic.\",\n  \"title\": \"Utilize a nova plataforma de assinatura\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"O nome do parâmetro do documento a ser enviado é **document[archive][original]**. O parâmetro geralmente vai dentro do corpo (_payload_) devido a requisição ser _multipart_.\",\n  \"title\": \"Atenção\"\n}\n[/block]\nApós o upload de um documento para a Clicksign, uma cópia carimbada do documento  com um **número de série** é criada e o *preview* é gerado. Enquanto o documento é processado a requisição **não fica bloqueada**. O `status` do documento será `working` , e após concluído passará para `editing`. Confira [fluxo dos status do documento](/docs/documentos#status-do-documento).\n\n### Requisição\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"Method\",\n    \"1-0\": \"Path\",\n    \"2-0\": \"Headers\",\n    \"0-1\": \"`POST`\",\n    \"1-1\": \"`/v1/documents?access_token=string`\",\n    \"2-1\": \"`Accept: application/json`\\n\\n`Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryjm7rLhiPSO6cEjWs`\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"  ------WebKitFormBoundaryjm7rLhiPSO6cEjWs\\n  Content-Disposition: form-data; name=\\\"document[archive][original]\\\"; filename=\\\"document-example.pdf\\\"\\n  Content-Type: application/pdf\\n\\n  ... data here ...\\n  ------WebKitFormBoundaryjm7rLhiPSO6cEjWs--\\n\",\n      \"language\": \"http\",\n      \"name\": \"Body\"\n    }\n  ]\n}\n[/block]\n### Resposta\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/1.1 200 OK\\nContent-Type:application/json\\nConnection: Keep-Alive\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"document\\\": {\\n    \\\"key\\\": \\\"9e1463e0-bb5b-44ec-a428-90aa530c6a0f\\\",\\n    \\\"original_name\\\": \\\"Lorem ipsum dolor sit amet.pdf\\\",\\n    \\\"status\\\": \\\"editing\\\",\\n    \\\"created_at\\\": \\\"2016-03-10T16:34:18.146-03:00\\\",\\n    \\\"updated_at\\\": \\\"2016-03-10T16:34:18.146-03:00\\\",\\n    \\\"user_key\\\": \\\"F8F4-4DD1-8642-20B7\\\",\\n    \\\"list\\\": {\\n      \\\"started_at\\\": null,\\n      \\\"created_at\\\": \\\"2016-03-10T16:34:18.128-03:00\\\",\\n      \\\"updated_at\\\": \\\"2016-03-10T16:34:18.128-03:00\\\",\\n      \\\"signatures\\\": []\\n    }\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Body\"\n    }\n  ]\n}\n[/block]\n### Exemplos\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"export DOMAIN=api.clicksign-demo.com\\nexport TOKEN=put-your-token-here\\nexport DOCUMENT=/home/joe/document-example.pdf\\n\\n# Realizar upload de um documento\\ncurl -X POST -H \\\"Accept: application/json\\\" -F \\\"document[archive][original]=:::at:::$DOCUMENT\\\" https://$DOMAIN/v1/documents?access_token=$TOKEN\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"require 'clicksign'\\n\\nClicksign.configure do |config|\\n  config.token = 'put-your-token-here'\\n  config.endpoint = 'https://api.clicksign-demo.com'\\nend\\n\\ndocument = Clicksign::Document.create(File.new('/home/joe/document-example.pdf'))\\n\",\n      \"language\": \"ruby\",\n      \"name\": \"Ruby\"\n    },\n    {\n      \"code\": \"require_once(__DIR__ . \\\"/clicksign/ClicksignClient.php\\\");\\n\\n$client = new ClicksignClient();\\n$client->setUrl(\\\"https://api.clicksign-demo.com/\\\")\\n$client->setAccessToken(\\\"put-your-token-here\\\");\\n\\n$client->documents->upload(\\\"/home/joe/document-example.pdf\\\");\",\n      \"language\": \"objectivec\",\n      \"name\": \"PHP\"\n    },\n    {\n      \"code\": \"// Config do projeto\\n<appSettings>\\n  <add key=\\\"Clicksign-Host\\\" value=\\\"https://api.clicksign-demo.com\\\"/>\\n  <add key=\\\"Clicksign-Token\\\" value=\\\"put-your-token-here\\\"/>\\n</appSettings>\\n  \\n// Upload de documento\\nvar clicksign = new Clicksign();\\n\\n//Envio através do caminho do arquivo\\nvar filePath = \\\"c:\\\\\\\\joe\\\\\\\\document-example.pdf\\\";\\n\\nclicksign.Upload(filePath);\\n\\nConsole.Write(clicksign.Document.Key);\\n\\n//Envio através dos bytes de um arquivo\\nvar fileBytes = File.ReadAllBytes(filePath);\\nvar fileName = Path.GetFileName(filePath);\\n\\nclicksign.Upload(fileBytes, fileName);\\n\\nConsole.Write(clicksign.Document.Key);\",\n      \"language\": \"csharp\",\n      \"name\": \".NET\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"upload","type":"basic","title":"Upload"}
[block:callout] { "type": "danger", "body": "Sugerimos que você utilize a nova plataforma da Clicksign. Consulte a documentação da API em https://developers.clicksign.com. \n\nEsta documentação é referente à API da plataforma Clicksign Classic.", "title": "Utilize a nova plataforma de assinatura" } [/block] [block:callout] { "type": "warning", "body": "O nome do parâmetro do documento a ser enviado é **document[archive][original]**. O parâmetro geralmente vai dentro do corpo (_payload_) devido a requisição ser _multipart_.", "title": "Atenção" } [/block] Após o upload de um documento para a Clicksign, uma cópia carimbada do documento com um **número de série** é criada e o *preview* é gerado. Enquanto o documento é processado a requisição **não fica bloqueada**. O `status` do documento será `working` , e após concluído passará para `editing`. Confira [fluxo dos status do documento](/docs/documentos#status-do-documento). ### Requisição [block:parameters] { "data": { "0-0": "Method", "1-0": "Path", "2-0": "Headers", "0-1": "`POST`", "1-1": "`/v1/documents?access_token=string`", "2-1": "`Accept: application/json`\n\n`Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryjm7rLhiPSO6cEjWs`" }, "cols": 2, "rows": 3 } [/block] [block:code] { "codes": [ { "code": " ------WebKitFormBoundaryjm7rLhiPSO6cEjWs\n Content-Disposition: form-data; name=\"document[archive][original]\"; filename=\"document-example.pdf\"\n Content-Type: application/pdf\n\n ... data here ...\n ------WebKitFormBoundaryjm7rLhiPSO6cEjWs--\n", "language": "http", "name": "Body" } ] } [/block] ### Resposta [block:code] { "codes": [ { "code": "HTTP/1.1 200 OK\nContent-Type:application/json\nConnection: Keep-Alive", "language": "http" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"document\": {\n \"key\": \"9e1463e0-bb5b-44ec-a428-90aa530c6a0f\",\n \"original_name\": \"Lorem ipsum dolor sit amet.pdf\",\n \"status\": \"editing\",\n \"created_at\": \"2016-03-10T16:34:18.146-03:00\",\n \"updated_at\": \"2016-03-10T16:34:18.146-03:00\",\n \"user_key\": \"F8F4-4DD1-8642-20B7\",\n \"list\": {\n \"started_at\": null,\n \"created_at\": \"2016-03-10T16:34:18.128-03:00\",\n \"updated_at\": \"2016-03-10T16:34:18.128-03:00\",\n \"signatures\": []\n }\n }\n}", "language": "json", "name": "Body" } ] } [/block] ### Exemplos [block:code] { "codes": [ { "code": "export DOMAIN=api.clicksign-demo.com\nexport TOKEN=put-your-token-here\nexport DOCUMENT=/home/joe/document-example.pdf\n\n# Realizar upload de um documento\ncurl -X POST -H \"Accept: application/json\" -F \"document[archive][original]=@$DOCUMENT\" https://$DOMAIN/v1/documents?access_token=$TOKEN", "language": "curl" }, { "code": "require 'clicksign'\n\nClicksign.configure do |config|\n config.token = 'put-your-token-here'\n config.endpoint = 'https://api.clicksign-demo.com'\nend\n\ndocument = Clicksign::Document.create(File.new('/home/joe/document-example.pdf'))\n", "language": "ruby", "name": "Ruby" }, { "code": "require_once(__DIR__ . \"/clicksign/ClicksignClient.php\");\n\n$client = new ClicksignClient();\n$client->setUrl(\"https://api.clicksign-demo.com/\")\n$client->setAccessToken(\"put-your-token-here\");\n\n$client->documents->upload(\"/home/joe/document-example.pdf\");", "language": "objectivec", "name": "PHP" }, { "code": "// Config do projeto\n<appSettings>\n <add key=\"Clicksign-Host\" value=\"https://api.clicksign-demo.com\"/>\n <add key=\"Clicksign-Token\" value=\"put-your-token-here\"/>\n</appSettings>\n \n// Upload de documento\nvar clicksign = new Clicksign();\n\n//Envio através do caminho do arquivo\nvar filePath = \"c:\\\\joe\\\\document-example.pdf\";\n\nclicksign.Upload(filePath);\n\nConsole.Write(clicksign.Document.Key);\n\n//Envio através dos bytes de um arquivo\nvar fileBytes = File.ReadAllBytes(filePath);\nvar fileName = Path.GetFileName(filePath);\n\nclicksign.Upload(fileBytes, fileName);\n\nConsole.Write(clicksign.Document.Key);", "language": "csharp", "name": ".NET" } ] } [/block]