{"id":76,"date":"2020-11-17T13:05:28","date_gmt":"2020-11-17T12:05:28","guid":{"rendered":"https:\/\/mxrdr-info.ocean.icm.edu.pl\/?page_id=76"},"modified":"2021-10-29T14:59:04","modified_gmt":"2021-10-29T12:59:04","slug":"data-uploading","status":"publish","type":"page","link":"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/data-uploading\/","title":{"rendered":"API commands"},"content":{"rendered":"\n<p>On this page you will learn how to upload data using API. Make sure you are both <a href=\"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/account-registration\/\" data-type=\"page\" data-id=\"186\">registered<\/a> and have created <a href=\"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/api-2\/\" data-type=\"page\" data-id=\"191\">API Token<\/a>. This page contains terminal commands that will create dataset, upload files to dataset. The commands are color coded as shown in the <a href=\"#API-color-coding\">color coding section<\/a>. There is also a command to <a href=\"#API-remove-dataset\">remove a dataset<\/a>. The contents are listed in order of increasing difficulty. <\/p>\n\n\n\n<p id=\"API-color-coding\">Color coding:<\/p>\n\n\n\n<p><span class=\"has-inline-color has-vivid-green-cyan-color\">terminal command<\/span><\/p>\n\n\n\n<p><span class=\"has-inline-color has-vivid-red-color\">variable<\/span> <span class=\"has-inline-color has-vivid-red-color\">definition or $variable invoke<\/span><\/p>\n\n\n\n<p><span class=\"has-inline-color has-vivid-cyan-blue-color\">file or path and file<\/span><\/p>\n\n\n\n<p><span class=\"has-inline-color has-vivid-purple-color\">string or path<\/span><\/p>\n\n\n\n<p class=\"has-normal-font-size\">To add new dataset to root repository using json file and API token use the following curl command:<\/p>\n\n\n\n<p style=\"font-size:12px\">curl -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/dataverses\/<span class=\"has-inline-color has-vivid-purple-color\">:root<\/span>\/datasets&#8221; &#8211;upload-file <span class=\"has-inline-color has-vivid-cyan-blue-color\">file.json<\/span><\/p>\n\n\n\n<p class=\"has-normal-font-size\">To add new dataset and store dataset id in the variable <em>mxrdrid<\/em> that can be utilized elsewhere in your scripts use the following curl command:<\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-red-color\">mxrdrid<\/span>=$( <span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/dataverses\/<span class=\"has-inline-color has-vivid-purple-color\">:root<\/span>\/datasets&#8221; &#8211;upload-file <span class=\"has-inline-color has-vivid-cyan-blue-color\">file.json<\/span> | <span class=\"has-inline-color has-vivid-green-cyan-color\">grep<\/span> -o -P &#8216;(?=&#8221;id&#8221;:).(?=,&#8221;persistentId&#8221;:)&#8217; | <span class=\"has-inline-color has-vivid-green-cyan-color\">grep<\/span> -o -P &#8216;(?=[0-9]).&#8217; )<\/p>\n\n\n\n<p class=\"has-normal-font-size\" id=\"API-dataverse-list\">To get identifiers of published dataverses in the repository use the following curl command:<\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;silent -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/search?q=<span class=\"has-inline-color has-vivid-purple-color\">*<\/span>&amp;type=<span class=\"has-inline-color has-vivid-purple-color\">dataverse<\/span>&amp;per<br>_page=<span class=\"has-inline-color has-vivid-purple-color\">1000<\/span>&#8221; | tr &#8216;,&#8217; &#8220;\\n&#8221; | grep -o -P &#8216;(?=&#8221;identifier&#8221;:&#8221;).*(?=&#8221;)&#8217; | replace &#8216;&#8221;identifier&#8221;:&#8221;&#8216; &#8221;<\/p>\n\n\n\n<p class=\"has-normal-font-size\" id=\"API-list-dataverses\">Then one can use those identifiers to upload datasets directly to specific dataverse. Using variable <em>dataverse<\/em> to upload:<\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-red-color\">mxrdrid<\/span>=$( <span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221; <\/span>-X POST &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/dataverses\/<span class=\"has-inline-color has-vivid-red-color\">$dataverse<\/span>\/datasets&#8221; &#8211;upload-file <span class=\"has-inline-color has-vivid-cyan-blue-color\">file.json<\/span> | <span class=\"has-inline-color has-vivid-green-cyan-color\">grep<\/span> -o -P &#8216;(?=&#8221;id&#8221;:).(?=,&#8221;persistentId&#8221;:)&#8217; | <span class=\"has-inline-color has-vivid-green-cyan-color\">grep<\/span> -o -P &#8216;(?=[0-9]).&#8217; )<\/p>\n\n\n\n<p class=\"has-normal-font-size\">To add file to an already existing dataset use the following curl command:<\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;silent &#8211;retry 10 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-cyan-blue-color\">@file.zip<\/span>&#8216; -F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<\/p>\n\n\n\n<p id=\"API-key-text-file\">One can use a text file <em>key.txt<\/em> as an <a href=\"https:\/\/mxrdr.icm.edu.pl\/dataverseuser.xhtml?selectTab=apiTokenTab\">API token<\/a>, the file should contain one line: <em>X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx<\/em> and can be used with the following curl command:<\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;silent &#8211;retry 10 -H <span class=\"has-inline-color has-vivid-cyan-blue-color\">@key.txt<\/span> -X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-cyan-blue-color\">@file.zip<\/span>&#8216; -F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<\/p>\n\n\n\n<p class=\"has-normal-font-size\" id=\"API-more-complicated-script\">With the previously given basic commands it is possible to build more complicated scripts to upload multiple datasets and files. For example:<\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-red-color\">originalpath<\/span>=$(<span class=\"has-inline-color has-vivid-green-cyan-color\">pwd<\/span>) # store current path in a variable &#8216;originalpath&#8217;<br><span class=\"has-inline-color has-vivid-red-color\">dataverse1<\/span>=<span class=\"has-inline-color has-vivid-purple-color\">ABC<\/span><br><span class=\"has-inline-color has-vivid-red-color\">dataverse2<\/span>=<span class=\"has-inline-color has-vivid-purple-color\">DEF<\/span><br><span class=\"has-inline-color has-vivid-red-color\">date<\/span>=$( <span class=\"has-inline-color has-vivid-green-cyan-color\">date<\/span> ) # store current date in a variable &#8216;date&#8217;<br><\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-red-color\">mxrdrid1<\/span>=$( <span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;retry 5 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/dataverses\/<span class=\"has-inline-color has-vivid-red-color\">$dataverse1<\/span>\/datasets&#8221; &#8211;upload-file <span class=\"has-inline-color has-vivid-cyan-blue-color\">file1.json<\/span> | <span class=\"has-inline-color has-vivid-green-cyan-color\">grep<\/span> -o -P &#8216;(?=&#8221;id&#8221;:).(?=,&#8221;persistentId&#8221;:)&#8217; | <span class=\"has-inline-color has-vivid-green-cyan-color\">grep<\/span> -o -P &#8216;(?=[0-9]).&#8217; )<br><span class=\"has-inline-color has-vivid-red-color\">mxrdrid2<\/span>=$( <span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;retry 5 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221; <\/span>-X POST &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/dataverses\/<span class=\"has-inline-color has-vivid-red-color\">$dataverse1<\/span>\/datasets&#8221; &#8211;upload-file <span class=\"has-inline-color has-vivid-cyan-blue-color\">file2.json<\/span> | <span class=\"has-inline-color has-vivid-green-cyan-color\">grep<\/span> -o -P &#8216;(?=&#8221;id&#8221;:).(?=,&#8221;persistentId&#8221;:)&#8217; | <span class=\"has-inline-color has-vivid-green-cyan-color\">grep<\/span> -o -P &#8216;(?=[0-9]).&#8217; )<br><span class=\"has-inline-color has-vivid-red-color\">mxrdrid3<\/span>=$( <span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;retry 5 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/dataverses\/<span class=\"has-inline-color has-vivid-red-color\">$dataverse2<\/span>\/datasets&#8221; &#8211;upload-file <span class=\"has-inline-color has-vivid-cyan-blue-color\">file3.json<\/span> | <span class=\"has-inline-color has-vivid-green-cyan-color\">grep<\/span> -o -P &#8216;(?=&#8221;id&#8221;:).(?=,&#8221;persistentId&#8221;:)&#8217; | <span class=\"has-inline-color has-vivid-green-cyan-color\">grep<\/span> -o -P &#8216;(?=[0-9]).&#8217; )<br><\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-red-color\">mxrdrid<\/span>=<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid1<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">cd<\/span> <span class=\"has-inline-color has-vivid-purple-color\">\/path\/to\/files\/1\/<\/span><br><span class=\"has-inline-color has-vivid-red-color\">file<\/span>=<span class=\"has-inline-color has-vivid-cyan-blue-color\">file1.jpeg<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;silent &#8211;retry 10 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-red-color\">@&#8217;$file&#8217;<\/span><span class=\"has-inline-color has-black-color\">&#8216; <\/span>-F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<br><span class=\"has-inline-color has-vivid-red-color\">file<\/span>=<span class=\"has-inline-color has-vivid-cyan-blue-color\">file1.zip<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;silent &#8211;retry 10 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-red-color\">@&#8217;$file&#8217;<\/span>&#8216; -F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<br><span class=\"has-inline-color has-vivid-red-color\">file<\/span>=<span class=\"has-inline-color has-vivid-cyan-blue-color\">file2.zip<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;silent &#8211;retry 10 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-red-color\">@&#8217;$file&#8217;<\/span>&#8216; -F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<br><span class=\"has-inline-color has-vivid-green-cyan-color\">cd<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">cd<\/span> <span class=\"has-inline-color has-vivid-cyan-blue-color\">$originalpath<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">echo<\/span> <span class=\"has-inline-color has-vivid-red-color\">$mxrdrid $file $date<\/span> &gt;&gt; <span class=\"has-inline-color has-vivid-cyan-blue-color\">mxrdridlog.txt<\/span><br><\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-red-color\">mxrdrid<\/span>=<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid2<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">cd<\/span> <span class=\"has-inline-color has-vivid-purple-color\">\/path\/to\/files\/2\/<\/span><br><span class=\"has-inline-color has-vivid-red-color\">file<\/span>=<span class=\"has-inline-color has-vivid-cyan-blue-color\">file1.jpeg<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;silent &#8211;retry 10 -H<span class=\"has-inline-color has-vivid-purple-color\"> &#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-red-color\">@&#8217;$file&#8217;<\/span>&#8216; -F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<br><span class=\"has-inline-color has-vivid-red-color\">file<\/span>=<span class=\"has-inline-color has-vivid-cyan-blue-color\">file1.zip<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;silent &#8211;retry 10 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-red-color\">@&#8217;$file&#8217;<\/span>&#8216; -F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<br><span class=\"has-inline-color has-vivid-red-color\">file<\/span>=<span class=\"has-inline-color has-vivid-cyan-blue-color\">file2.zip<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;silent &#8211;retry 10 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221; <\/span>-X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-red-color\">@&#8217;$file&#8217;<\/span>&#8216; -F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<br><span class=\"has-inline-color has-vivid-green-cyan-color\">cd<br>cd<\/span> <span class=\"has-inline-color has-vivid-red-color\">$originalpath<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">echo<\/span> <span class=\"has-inline-color has-vivid-red-color\">$mxrdrid $file $date <\/span>&gt;&gt; <span class=\"has-inline-color has-vivid-cyan-blue-color\">mxrdridlog.txt<\/span><br><\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-red-color\">mxrdrid<\/span>=<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid3<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">cd<\/span> <span class=\"has-inline-color has-vivid-purple-color\">\/path\/to\/files\/3\/<\/span><br><span class=\"has-inline-color has-vivid-red-color\">file<\/span>=<span class=\"has-inline-color has-vivid-cyan-blue-color\">file1.jpeg<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> &#8211;silent &#8211;retry 10 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-red-color\">@&#8217;$file&#8217;<\/span>&#8216; -F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<br><span class=\"has-inline-color has-vivid-red-color\">file<\/span>=<span class=\"has-inline-color has-vivid-cyan-blue-color\">file1.zip<\/span><br>curl &#8211;silent &#8211;retry 10 -H<span class=\"has-inline-color has-vivid-purple-color\"> &#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-red-color\">@&#8217;$file&#8217;<\/span>&#8216; -F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<br><span class=\"has-inline-color has-vivid-red-color\">file<\/span>=<span class=\"has-inline-color has-vivid-cyan-blue-color\">file2.zip<\/span><br>curl &#8211;silent &#8211;retry 10 -H <span class=\"has-inline-color has-vivid-purple-color\">&#8220;X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<\/span> -X POST -F &#8216;file=<span class=\"has-inline-color has-vivid-red-color\">@&#8217;$file&#8217;<\/span>&#8216; -F &#8216;jsonData={&#8220;description&#8221;:&#8221;&#8221;,&#8221;termsOfUseAndAccess&#8221;:{&#8220;termsType&#8221;:&#8221;LICENSE_BASED&#8221;,&#8221;license&#8221;:<span class=\"has-inline-color has-vivid-purple-color\">&#8220;CC BY Creative Commons Attribution License 4.0&#8221;<\/span>}}&#8217; &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>\/add&#8221;<br><span class=\"has-inline-color has-vivid-green-cyan-color\">cd<br>cd<\/span> <span class=\"has-inline-color has-vivid-red-color\">$originalpath<\/span><br><span class=\"has-inline-color has-vivid-green-cyan-color\">echo<\/span> <span class=\"has-inline-color has-vivid-red-color\">$mxrdrid $file $date<\/span> &gt;&gt; <span class=\"has-inline-color has-vivid-cyan-blue-color\">mxrdridlog.txt<\/span><\/p>\n\n\n\n<p class=\"has-normal-font-size\" id=\"API-remove-dataset\">To remove a dataset use the following commad:<\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-green-cyan-color\">curl<\/span> -H <span class=\"has-inline-color has-vivid-cyan-blue-color\">@key.txt<\/span> -X DELETE &#8220;https:\/\/mxrdr.icm.edu.pl\/api\/datasets\/<span class=\"has-inline-color has-vivid-red-color\">$mxrdrid<\/span>&#8220;<\/p>\n\n\n\n<p id=\"API-adxv\">To create new jpeg image based on a raw diffraction image use the following command that uses <em>adxv<\/em>:<\/p>\n\n\n\n<p style=\"font-size:12px\"><span class=\"has-inline-color has-vivid-green-cyan-color\">adxv<\/span> -jpeg_quality 100 -sa<span class=\"has-inline-color has-vivid-cyan-blue-color\"> image.cbf image.jpeg<\/span><\/p>\n\n\n\n<p>To create new jpeg image based on a raw diffraction image that could be utilized in a more complicated script use (here we have used <a href=\"#API-more-complicated-script\">this<\/a> as an example):<\/p>\n\n\n\n<p style=\"font-size:12px\">&#8230;<br><span class=\"has-inline-color has-vivid-green-cyan-color\">cd<\/span> <span class=\"has-inline-color has-vivid-purple-color\">\/path\/to\/files\/1\/<\/span><br><span class=\"has-inline-color has-vivid-red-color\">fileraw<\/span>=$ (<span class=\"has-inline-color has-vivid-green-cyan-color\">ls<\/span> -1 <span class=\"has-inline-color has-vivid-cyan-blue-color\">*.cbf<\/span> | <span class=\"has-inline-color has-vivid-green-cyan-color\">head<\/span> -1)<br><span class=\"has-inline-color has-vivid-red-color\">file<\/span>=&#8221;<span class=\"has-inline-color has-vivid-red-color\">${fileraw%.*}<\/span>&#8220;<br><span class=\"has-inline-color has-vivid-green-cyan-color\">adxv<\/span> -jpeg_quality 100 -sa <span class=\"has-inline-color has-vivid-red-color\">$fileraw<\/span> <span class=\"has-inline-color has-vivid-red-color\">$file<\/span><span class=\"has-inline-color has-vivid-cyan-blue-color\">.jpeg<\/span><br>&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On this page you will learn how to upload data using API. Make sure you are both registered and have created API Token. This page contains terminal commands that will create dataset, upload files to dataset. The commands are color coded as shown in the color coding section. There is also a command to remove &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/data-uploading\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;API commands&#8221;<\/span><\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/wp-json\/wp\/v2\/pages\/76"}],"collection":[{"href":"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/wp-json\/wp\/v2\/comments?post=76"}],"version-history":[{"count":48,"href":"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/wp-json\/wp\/v2\/pages\/76\/revisions"}],"predecessor-version":[{"id":600,"href":"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/wp-json\/wp\/v2\/pages\/76\/revisions\/600"}],"wp:attachment":[{"href":"https:\/\/info.mxrdr.icm.edu.pl\/index.php\/wp-json\/wp\/v2\/media?parent=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}