{"id":6535,"date":"2022-01-09T20:17:46","date_gmt":"2022-01-09T19:17:46","guid":{"rendered":"https:\/\/help.cirrus-shield.com\/docs\/developer-guide\/rest-api\/downloadfile\/"},"modified":"2022-01-11T09:43:01","modified_gmt":"2022-01-11T08:43:01","slug":"downloadfile","status":"publish","type":"docs","link":"https:\/\/help.cirrus-shield.com\/en\/docs\/developer-guide\/rest-api\/downloadfile\/","title":{"rendered":"7. DownloadFile"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li><strong><span class=\"has-inline-color has-luminous-vivid-orange-color\"><u>URL:<\/u> <\/span><\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\u00ab \/RestApi\/<a href=\"URL: \n\n\n\n\u00ab \/RestApi\/UploadFile\u00bb\n\n\n\nM\u00e9thode:&nbsp;POSTParam\u00e8tres URL:authToken &#91;string] &#91;Required]=l'authentication tokenfileName &#91;string] &#91;Required]=le nom du champ que l'utilisateur veut importerobjectName &#91;string] &#91;Required]=le nom de l'enregistrement de l'objet dans lequel l'utilisateur veut importer un fichierfieldName &#91;string] &#91;Required]=le nom API name du champ dans lequel le fichier va \u00eatre import\u00e9RecGUID &#91;long] &#91;Required]=l'enregistrement Id dans CirrusShield dans lequel le fichier va \u00eatre import\u00e9Param\u00e8tres de donn\u00e9es:dataStream =les donn\u00e9es du fichier import\u00e9\n\n\n\nExample:\n\n\n\n\/\/ Get file name\n\n$fileName = $_FILES&#91;'file_upl']&#91;'name'];\n\/\/ Get file content\n\n$data = file_get_contents($_FILES&#91;'file_upl']&#91;'tmp_name']);\n\/\/ Transform file content to json array\n\n$array = array();\n\nforeach(str_split($data) as $char){\narray_push($array, ord($char));\n}\n\/\/ Send the Data Params\n\ncurl_setopt($client, CURLOPT_POSTFIELDS, &quot;=&quot;.json_encode($array));\n<form name=&quot;file_up&quot; action=&quot;UploadFile.php&quot; method=&quot;POST&quot; enctype=&quot;multipart\/form-data&quot;>\nUpload your file here\n\n<input type=&quot;file&quot; name=&quot;file_upl&quot; id=&quot;file_upl&quot;\/>\n\n<input type=&quot;submit&quot; name=&quot;action&quot; value=&quot;submit&quot;\/>\n<\/form>\n\n\n\nR\u00e9ponse de succ\u00e8s:Status Code=200 (OK)R\u00e9ponse d'erreur:Status Code=400 (BadRequest) (au cas o\u00f9 il y a une erreur dand les donn\u00e9es JSON envoy\u00e9es dans le HTTP Post Request body ou le nom de l'objet, nom champ API dans l'objet ou dans l'enregistrement Id est incorrect)\">DownloadFile<\/a> \u00bb<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><span class=\"has-inline-color has-luminous-vivid-orange-color\"><u>Mthod:<\/u>&nbsp;<\/span><\/strong>GET<br><\/li><li><strong><u><span class=\"has-inline-color has-luminous-vivid-orange-color\">URL Settings:<\/span><\/u><\/strong><ul><li>authToken [string] [Required]=the authentification token<\/li><li>objectName [string] [Required]=the name of the object that contains the file.<\/li><\/ul><ul><li>fieldName [string] [Required]=the name of the field (API name) that contains the file. This field is one of the fields of the objectName object.<\/li><li>RecordId [long] [Required]=the ID of the record from which you want to retrieve the file.<\/li><\/ul><\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><u><span class=\"has-inline-color has-luminous-vivid-orange-color\">Success Response<\/span><\/u><\/strong><ul><li>Status Code=200 (OK)<br><\/li><\/ul><\/li><li><strong><u><span class=\"has-inline-color has-luminous-vivid-orange-color\">Error Response:<\/span><\/u><\/strong><ul><li>Status Code=400 (BadRequest) (in case there is an error in the JSON data sent in the HTTP Post Request body or the object name, API field name in the object or in the Id record is incorrect)<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":944,"menu_order":6,"comment_status":"open","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_tag":[],"class_list":["post-6535","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/comments?post=6535"}],"version-history":[{"count":1,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6535\/revisions"}],"predecessor-version":[{"id":6536,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6535\/revisions\/6536"}],"up":[{"embeddable":true,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/944"}],"next":[{"title":"8. SendEmail","link":"https:\/\/help.cirrus-shield.com\/en\/docs\/developer-guide\/rest-api\/sendemail\/","href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6509"}],"prev":[{"title":"6. Upload File","link":"https:\/\/help.cirrus-shield.com\/en\/docs\/developer-guide\/rest-api\/upload-file\/","href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/3955"}],"wp:attachment":[{"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/media?parent=6535"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/doc_tag?post=6535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}