{"info":{"_postman_id":"6be39552-933b-4d00-9d42-67d3f65fefd3","name":"API Documentation #reference","description":"<html><head></head><body><p>The analyses-api provides APIs that enable you to perform data analyses on csv data.</p>\n<p>Currently there are provisions for:</p>\n<ul>\n<li>mutlivariable linear regression</li>\n</ul>\n<p>with support for many more analyses operation coming along.</p>\n<h2 id=\"getting-started-guide\"><strong>Getting started guide</strong></h2>\n<p>To start using analyses APIs, you need to -</p>\n<ul>\n<li>You must create an account, and then sign in to the account to obtain an authentication token.</li>\n<li>You must upload data in csv format.</li>\n<li>You must use a valid API Key to send requests to the API analyses endpoints. You can get your API key</li>\n<li>The API only responds to HTTPS-secured communications. Any requests sent via HTTP return an HTTP 301 redirect to the corresponding HTTPS resources.</li>\n<li>The API returns request responses in JSON format. When an API request returns an error, it is sent in the JSON response as an error key.</li>\n</ul>\n<h2 id=\"authentication\">Authentication</h2>\n<p>The analyses-api API uses <code>bearer token</code> for authentication. You can generate an authentication token by sign in to a created account.</p>\n<blockquote>\n<p>You must include an API key in each request to the files and analyses endpoints with the <code>Authorization</code> request header. </p>\n</blockquote>\n<h3 id=\"authentication-error-response\">Authentication error response</h3>\n<p>If authentication token is missing, malformed, or invalid, you will receive an HTTP 401 Unauthorized response code.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"17081738","collectionId":"6be39552-933b-4d00-9d42-67d3f65fefd3","publishedId":"2s9YsT6oZJ","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2024-01-20T12:50:13.000Z"},"item":[{"name":"User","item":[{"name":"Register user","id":"62b637ba-b8e4-43f3-a4f5-4a13316fd86b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"username\": \"Anonymous\",\n    \"email\": \"anonymous@email.com\",\n    \"password\": \"asdf;lkj0\"\n}","options":{"raw":{"language":"json"}}},"url":"https://analyses-api.onrender.com/users/register","description":"<p>creates new user in the database using the data in the body of the request. The endpoint expects a POST request with a json body with the following key:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"username\": \"****\"  // alphanumeric user's username\n    \"password\": \"****\"  // atleat 8 character user's password\n    \"email\": \"****\"     // user's email\n}\n\n</code></pre>\n<p>The request returns response with the following http status codes:</p>\n<p><code>200 - status OK:</code></p>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"user\": {\n            \"username\":\"****\",\n            \"email\": \"*****\",\n            \"password_changed_at\": \"*****\",\n            \"created_at\": \"*****\"\n        },\n        \"error\":\"\"\n     }\n\n</code></pre>\n<p><code>400 - status Bad Request:</code></p>\n<ul>\n<li>Error parsing request body.</li>\n</ul>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"user\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n<p><code>403 - status Forbidden:</code></p>\n<ul>\n<li>If username or email already exists.</li>\n</ul>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"user\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n<p><code>501 - status Internal Server Error:</code></p>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"user\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n","auth":{"type":"bearer","bearer":{"basicConfig":[]},"isInherited":true,"source":{"_postman_id":"6be39552-933b-4d00-9d42-67d3f65fefd3","id":"6be39552-933b-4d00-9d42-67d3f65fefd3","name":"API Documentation #reference","type":"collection"}},"urlObject":{"protocol":"https","path":["users","register"],"host":["analyses-api","onrender","com"],"query":[],"variable":[]}},"response":[{"id":"6e703f20-ac57-4d17-b76f-1856cc83c482","name":"Successful Response","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"username\": \"Anonymous\",\n    \"email\": \"anonymous@email.com\",\n    \"password\": \"asdf;lkj0\"\n}","options":{"raw":{"language":"json"}}},"url":"https://analyses-apiv2.onrender.com/users/register"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Date","value":"Thu, 11 Jan 2024 18:20:51 GMT"},{"key":"Content-Length","value":"162"}],"cookie":[],"responseTime":null,"body":"{\n    \"user\": {\n        \"username\": \"Anonymous\",\n        \"email\": \"anonymous@email.com\",\n        \"password_changed_at\": \"0001-01-01T00:00:00Z\",\n        \"created_at\": \"2024-01-11T18:20:51.855045Z\"\n    },\n    \"error\": \"\"\n}"}],"_postman_id":"62b637ba-b8e4-43f3-a4f5-4a13316fd86b"},{"name":"Get authenticated user","event":[{"listen":"test","script":{"id":"48ee50c5-b93d-43c9-9f1a-fa7ff7e6842c","exec":[""],"type":"text/javascript"}}],"id":"474cd736-7ffa-4254-b6c1-dc37738c53a1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"Anonymous\",\n    \"password\": \"asdf;lkj0\"\n}","options":{"raw":{"language":"json"}}},"url":"https://analyses-api.onrender.com/users/login","description":"<p>Gets information about the authenticated user.</p>\n<p>The endpoint expects a GET request with a json body with the following key:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"username\": \"****\" // alphanumeric user's username\n    \"password\": \"****\" // atleat 8 character user's password\n}\n\n</code></pre>\n<p>The request returns response with the following http status codes:</p>\n<p><code>200 - status OK:</code></p>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"access_token\": \"*****\",\n    \"user\": {\n        \"username\":\"****\",\n        \"email\": \"*****\",\n        \"password_changed_at\": \"*****\",\n        \"created_at\": \"*****\"\n    },\n    \"error\":\"\"\n}\n\n</code></pre>\n<p><code>400 - status Bad Request:</code></p>\n<ul>\n<li>Error parsing the request's body.</li>\n</ul>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"access_token\": \"\",\n        \"user\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n<p><code>404 - status Not Found:</code></p>\n<ul>\n<li>If user with username does not exist.</li>\n</ul>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"access_token\": \"\",\n        \"user\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n<p><code>401 - status Unauthorized:</code></p>\n<ul>\n<li>If password does not match existing user's password.</li>\n</ul>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"access_token\": \"\",\n        \"user\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n<p><code>501 - status Internal Server Error:</code></p>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"user\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n","auth":{"type":"bearer","bearer":{"basicConfig":[]},"isInherited":true,"source":{"_postman_id":"6be39552-933b-4d00-9d42-67d3f65fefd3","id":"6be39552-933b-4d00-9d42-67d3f65fefd3","name":"API Documentation #reference","type":"collection"}},"urlObject":{"protocol":"https","path":["users","login"],"host":["analyses-api","onrender","com"],"query":[],"variable":[]}},"response":[{"id":"e6d539b2-1f43-47ca-9de7-beb84e1a4bf1","name":"Successful Response","originalRequest":{"method":"GET","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"Anonymous\",\n    \"password\": \"asdf;lkj0\"\n}","options":{"raw":{"language":"json"}}},"url":"https://analyses-apiv2.onrender.com/users/login"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Date","value":"Thu, 11 Jan 2024 18:24:53 GMT"},{"key":"Content-Length","value":"484"}],"cookie":[],"responseTime":null,"body":"{\n    \"access_token\": \"v4.local.J0RyUjIy4fqDCUoOOiGQTGQqgBQa6_hrWdTyueNSGBZfqUITW3Uk0u1YBiiOfSVf779C-ep1o8Cxb22t7e44sveuY2hrIFtgwQFdKUEKlSc-037X9pUCweXwLVvaNZ2QshjUzrdG4HFutQN3SJttuzcnDz-Bbu6am6roY4v5dI9rv_9G1UnMZF4j7e0q08jxvvHKLMbAf6IUo9Il-SdV039rvmDAr5rjI6QS8REDkLFCk4x_Jxmy0V8SC58CntcSABrQ6qTA8-IcSfRALCR9cj_TqnRs0jAsWKiU8PU\",\n    \"user\": {\n        \"username\": \"Anonymous\",\n        \"email\": \"anonymous@email.com\",\n        \"password_changed_at\": \"0001-01-01T00:00:00Z\",\n        \"created_at\": \"2024-01-11T18:20:51.855045Z\"\n    },\n    \"error\": \"\"\n}"}],"_postman_id":"474cd736-7ffa-4254-b6c1-dc37738c53a1"}],"id":"3566a3d4-580e-4f5d-a475-d872f9e454e4","description":"<p>The <code>/users/</code> endpoints gives you access to the services, allowing you to create an account, and sign in to created accounts.</p>\n","_postman_id":"3566a3d4-580e-4f5d-a475-d872f9e454e4","auth":{"type":"bearer","bearer":{"basicConfig":[]},"isInherited":true,"source":{"_postman_id":"6be39552-933b-4d00-9d42-67d3f65fefd3","id":"6be39552-933b-4d00-9d42-67d3f65fefd3","name":"API Documentation #reference","type":"collection"}}},{"name":"Files","item":[{"name":"File Upload","id":"317c45c1-44ac-4ecc-9842-73d301d8ef09","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"<token>"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"file","type":"text","value":"path/to/csv_data.csv"},{"key":"username","value":"Anonymous","type":"text"}]},"url":"https://analyses-apiv2.onrender.com/files/upload","description":"<p>uploads encoded user data to the database using the data in the body of the request. If a user has a file in the database, the new file replaces the old file in the database. The endpoint expects a POST request with a form-data body with the following key:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">`username`   - alphanumeric user's username\n`file`       - a csv file.\n\n</code></pre>\n<p>The request returns response with the following http status codes:</p>\n<p><code>200 - status OK:</code></p>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"file\": {\n            \"id\":\"****\",\n            \"changed_at\": \"*****\",\n        },\n        \"error\":\"\"\n     }\n\n</code></pre>\n<p><code>400 - status Bad Request:</code></p>\n<ul>\n<li>Error parsing request body, and missing `username` or `file` key.</li>\n</ul>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"file\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n<p><code>401 - status Unauthorized:</code></p>\n<ul>\n<li>If access token has expired or username in request body don't match usernamein token payload.</li>\n<li>with response body:</li>\n</ul>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"file\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n<p><code>413 - status Request Entity Too Large:</code></p>\n<ul>\n<li>If file size exceed maximum limit.</li>\n</ul>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"file\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n<p><code>501 - status Internal Server Error:</code></p>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">    {\n        \"file\": {},\n        \"error\": \"*****\"\n    }\n\n</code></pre>\n","urlObject":{"protocol":"https","path":["files","upload"],"host":["analyses-apiv2","onrender","com"],"query":[],"variable":[]}},"response":[{"id":"a3a899a3-6554-4ecf-9955-9757db74ef4a","name":"Successful Response","originalRequest":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"file","type":"text","value":"path/to/csv_data.csv"},{"key":"username","value":"Anonymous","type":"text"}]},"url":"https://analyses-apiv2.onrender.com/files/upload"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Date","value":"Sat, 20 Jan 2024 12:44:42 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Transfer-Encoding","value":"chunked"},{"key":"Connection","value":"keep-alive"},{"key":"CF-Ray","value":"8487690b3df266df-AMS"},{"key":"CF-Cache-Status","value":"DYNAMIC"},{"key":"Vary","value":"Accept-Encoding"},{"key":"rndr-id","value":"413e5f19-74c6-46d6"},{"key":"x-render-origin-server","value":"Render"},{"key":"Server","value":"cloudflare"},{"key":"Content-Encoding","value":"br"},{"key":"alt-svc","value":"h3=\":443\"; ma=86400"}],"cookie":[],"responseTime":null,"body":"{\n    \"file\": {\n        \"id\": 1,\n        \"changed_at\": \"2024-01-20T12:44:42.709097Z\"\n    },\n    \"error\": \"\"\n}"}],"_postman_id":"317c45c1-44ac-4ecc-9842-73d301d8ef09"}],"id":"04177d91-3752-420d-b796-953b11d32cf3","description":"<p>The <code>/files/</code> endpoints gives you access to upload data to be used for analysis.</p>\n","_postman_id":"04177d91-3752-420d-b796-953b11d32cf3","auth":{"type":"bearer","bearer":{"basicConfig":[]},"isInherited":true,"source":{"_postman_id":"6be39552-933b-4d00-9d42-67d3f65fefd3","id":"6be39552-933b-4d00-9d42-67d3f65fefd3","name":"API Documentation #reference","type":"collection"}}},{"name":"Analyses","item":[{"name":"Linear Regression","id":"2a4667b3-8b28-4cde-9aa2-5cfc3ef7b3bb","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"<token>"}]},"isInherited":false},"method":"GET","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"Anonymous\"\n}","options":{"raw":{"language":"json"}}},"url":"https://analyses-apiv2.onrender.com/analyses/regression","description":"<p>Gets information about the authenticated user.</p>\n<p>The endpoint expects a GET request with a json body with the following key:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"username\": \"****\" // alphanumeric user's username\n}\n\n</code></pre>\n<p>The request returns response with the following http status codes:</p>\n<p><code>200 - status OK:</code></p>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"regression_coefficients\": \"****\",\n    \"t-test statistics\": \"****\",\n    \"error\": \"\"\n}\n\n</code></pre>\n<p><code>400 - status Bad Request:</code></p>\n<ul>\n<li>Error parsing the request's body.</li>\n</ul>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"regression_coefficients\": \"\",\n    \"t-test statistics\": \"\",\n    \"error\": \"****\"\n}\n\n</code></pre>\n<p><code>401 - status Unauthorized:</code></p>\n<ul>\n<li>If request's username does not match username in authentication payload.</li>\n</ul>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"regression_coefficients\": \"\",\n    \"t-test statistics\": \"\",\n    \"error\": \"****\"\n}\n\n</code></pre>\n<p><code>501 - status Internal Server Error:</code></p>\n<p>with response body:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"regression_coefficients\": \"\",\n    \"t-test statistics\": \"\",\n    \"error\": \"****\"\n}\n\n</code></pre>\n","urlObject":{"protocol":"https","path":["analyses","regression"],"host":["analyses-apiv2","onrender","com"],"query":[],"variable":[]}},"response":[{"id":"554f8def-2754-4760-b11c-bdfd27f0024a","name":"Successful Response","originalRequest":{"method":"GET","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"Anonymous\"\n}","options":{"raw":{"language":"json"}}},"url":"https://analyses-apiv2.onrender.com/analyses/regression"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Date","value":"Sat, 20 Jan 2024 12:45:25 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Transfer-Encoding","value":"chunked"},{"key":"Connection","value":"keep-alive"},{"key":"CF-Ray","value":"84876a167dcf66df-AMS"},{"key":"CF-Cache-Status","value":"DYNAMIC"},{"key":"Vary","value":"Accept-Encoding"},{"key":"rndr-id","value":"03e80891-b175-4f04"},{"key":"x-render-origin-server","value":"Render"},{"key":"Server","value":"cloudflare"},{"key":"Content-Encoding","value":"br"},{"key":"alt-svc","value":"h3=\":443\"; ma=86400"}],"cookie":[],"responseTime":null,"body":"{\n    \"regression_coefficients\": \"[[33.22276], [0.03454], [-1.03207]]\",\n    \"t-test statistics\": \"[[45.36742], [2.81998], [-21.37371]]\",\n    \"error\": \"\"\n}"}],"_postman_id":"2a4667b3-8b28-4cde-9aa2-5cfc3ef7b3bb"}],"id":"4681ec79-464d-4ae9-bf2e-ca842877384c","description":"<p>The <code>/analyses/</code> endpoints gives you access to perform data analysis on uploaded csv data.</p>\n","_postman_id":"4681ec79-464d-4ae9-bf2e-ca842877384c","auth":{"type":"bearer","bearer":{"basicConfig":[]},"isInherited":true,"source":{"_postman_id":"6be39552-933b-4d00-9d42-67d3f65fefd3","id":"6be39552-933b-4d00-9d42-67d3f65fefd3","name":"API Documentation #reference","type":"collection"}}}],"auth":{"type":"bearer","bearer":{"basicConfig":[]}},"event":[{"listen":"prerequest","script":{"id":"d99aff6c-13ff-48ea-83e6-a972a4d9f649","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"0e1a6ece-354c-4fd6-9e96-f5f1dc58304b","type":"text/javascript","exec":[""]}}],"variable":[{"key":"dataPath","value":"/home/ifrodostein/Downloads/data.csv","type":"string"}]}