From 90569609498eb92569096be0d4f3ba214e7ed400 Mon Sep 17 00:00:00 2001 From: kadhir-17 Date: Thu, 22 Aug 2024 12:39:46 +0000 Subject: [PATCH] deploy: ab83dc35db39f62220f1c8c0c656af1a5800f112 --- 404.html | 4 ++-- assets/js/55ccdc72.ad9c4214.js | 1 + assets/js/55ccdc72.fa5d934e.js | 1 - .../{runtime~main.c487b516.js => runtime~main.9d207e6c.js} | 2 +- docs/category/admin-apis/index.html | 4 ++-- docs/category/android-native-sdk/index.html | 4 ++-- docs/category/flutter-player-sdk/index.html | 4 ++-- docs/category/ios-native-sdk/index.html | 4 ++-- docs/category/javascript-sdk/index.html | 4 ++-- docs/category/player-sdks/index.html | 4 ++-- docs/category/plugins/index.html | 4 ++-- docs/category/server-apis/index.html | 4 ++-- docs/category/students-apis/index.html | 4 ++-- docs/intro/index.html | 4 ++-- .../Integration/create attempt by HMAC/index.html | 4 ++-- docs/server-api/Integration/exam-webhook/index.html | 4 ++-- .../Integration/review attempt by HMAC/index.html | 4 ++-- docs/server-api/Integration/single-sign-on/index.html | 4 ++-- docs/server-api/admin-apis/attempts/index.html | 6 +++--- docs/server-api/admin-apis/batches/index.html | 4 ++-- docs/server-api/admin-apis/courses/index.html | 4 ++-- docs/server-api/admin-apis/exams/index.html | 4 ++-- docs/server-api/admin-apis/mentors/index.html | 4 ++-- docs/server-api/admin-apis/posts/index.html | 4 ++-- docs/server-api/admin-apis/users/index.html | 4 ++-- docs/server-api/admin-apis/videos/index.html | 4 ++-- docs/server-api/students-apis/attempts/index.html | 4 ++-- docs/server-api/students-apis/basic-example/index.html | 4 ++-- docs/server-api/students-apis/exams/index.html | 4 ++-- docs/server-api/students-apis/posts/index.html | 4 ++-- docs/server-api/students-apis/products/index.html | 4 ++-- docs/server-api/students-apis/users/index.html | 4 ++-- docs/server-api/students-apis/videos/index.html | 4 ++-- docs/video-embedding/authentication/index.html | 4 ++-- docs/video-embedding/domain-restriction/index.html | 4 ++-- docs/video-embedding/getting-starting/index.html | 4 ++-- .../android-native-sdk/getting-started/index.html | 4 ++-- .../android-native-sdk/offline-downloads/index.html | 4 ++-- .../player-sdk/flutter-sdk/getting_started/index.html | 4 ++-- .../player-sdk/ios-native-sdk/getting-started/index.html | 4 ++-- .../player-sdk/javascript-sdk/introduction/index.html | 4 ++-- .../player-sdk/javascript-sdk/player-events/index.html | 4 ++-- .../player-sdk/javascript-sdk/player-methods/index.html | 4 ++-- .../player-sdk/javascript-sdk/plugins/markers/index.html | 4 ++-- .../player-sdk/javascript-sdk/using-player-sdk/index.html | 4 ++-- docs/video-embedding/server-apis/access_token/index.html | 4 ++-- docs/video-embedding/watermarking/index.html | 4 ++-- index.html | 4 ++-- markdown-page/index.html | 4 ++-- 49 files changed, 95 insertions(+), 95 deletions(-) create mode 100644 assets/js/55ccdc72.ad9c4214.js delete mode 100644 assets/js/55ccdc72.fa5d934e.js rename assets/js/{runtime~main.c487b516.js => runtime~main.9d207e6c.js} (98%) diff --git a/404.html b/404.html index a5889a6..946aefb 100644 --- a/404.html +++ b/404.html @@ -4,13 +4,13 @@ Page Not Found | Testpress docs - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/assets/js/55ccdc72.ad9c4214.js b/assets/js/55ccdc72.ad9c4214.js new file mode 100644 index 0000000..224402a --- /dev/null +++ b/assets/js/55ccdc72.ad9c4214.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunktestpress_docs=self.webpackChunktestpress_docs||[]).push([[9251],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),o=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},u=function(e){var t=o(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=o(n),m=r,k=d["".concat(p,".").concat(m)]||d[m]||c[m]||l;return n?a.createElement(k,s(s({ref:t},u),{},{components:n})):a.createElement(k,s({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,s=new Array(l);s[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var o=2;o{n.d(t,{Z:()=>s});var a=n(7294),r=n(6010);const l="tabItem_Ymn6";function s(e){let{children:t,hidden:n,className:s}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(l,s),hidden:n},t)}},5488:(e,t,n)=>{n.d(t,{Z:()=>m});var a=n(7462),r=n(7294),l=n(6010),s=n(2389),i=n(7392),p=n(7094),o=n(2466);const u="tabList__CuJ",c="tabItem_LNqP";function d(e){var t;const{lazy:n,block:s,defaultValue:d,values:m,groupId:k,className:b}=e,h=r.Children.map(e.children,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})),y=m??h.map((e=>{let{props:{value:t,label:n,attributes:a}}=e;return{value:t,label:n,attributes:a}})),_=(0,i.l)(y,((e,t)=>e.value===t.value));if(_.length>0)throw new Error(`Docusaurus error: Duplicate values "${_.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`);const N=null===d?d:d??(null==(t=h.find((e=>e.props.default)))?void 0:t.props.value)??h[0].props.value;if(null!==N&&!y.some((e=>e.value===N)))throw new Error(`Docusaurus error: The has a defaultValue "${N}" but none of its children has the corresponding value. Available values are: ${y.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);const{tabGroupChoices:g,setTabGroupChoices:v}=(0,p.U)(),[I,w]=(0,r.useState)(N),f=[],{blockElementScrollPositionUntilNextRender:T}=(0,o.o5)();if(null!=k){const e=g[k];null!=e&&e!==I&&y.some((t=>t.value===e))&&w(e)}const R=e=>{const t=e.currentTarget,n=f.indexOf(t),a=y[n].value;a!==I&&(T(t),w(a),null!=k&&v(k,String(a)))},C=e=>{var t;let n=null;switch(e.key){case"Enter":R(e);break;case"ArrowRight":{const t=f.indexOf(e.currentTarget)+1;n=f[t]??f[0];break}case"ArrowLeft":{const t=f.indexOf(e.currentTarget)-1;n=f[t]??f[f.length-1];break}}null==(t=n)||t.focus()};return r.createElement("div",{className:(0,l.Z)("tabs-container",u)},r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":s},b)},y.map((e=>{let{value:t,label:n,attributes:s}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:I===t?0:-1,"aria-selected":I===t,key:t,ref:e=>f.push(e),onKeyDown:C,onClick:R},s,{className:(0,l.Z)("tabs__item",c,null==s?void 0:s.className,{"tabs__item--active":I===t})}),n??t)}))),n?(0,r.cloneElement)(h.filter((e=>e.props.value===I))[0],{className:"margin-top--md"}):r.createElement("div",{className:"margin-top--md"},h.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==I})))))}function m(e){const t=(0,s.Z)();return r.createElement(d,(0,a.Z)({key:String(t)},e))}},679:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var a=n(7462),r=(n(7294),n(3905)),l=n(5488),s=n(5162);const i={sidebar_position:4},p="Attempts",o={unversionedId:"server-api/admin-apis/attempts",id:"server-api/admin-apis/attempts",title:"Attempts",description:"Admin APIs require authorization token with admin privileges. You check the following link to generate authorization token. You need to provide admin username and password to generate token with admin privileges",source:"@site/docs/server-api/admin-apis/attempts.md",sourceDirName:"server-api/admin-apis",slug:"/server-api/admin-apis/attempts",permalink:"/docs/server-api/admin-apis/attempts",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"serverAPISidebar",previous:{title:"Mentors",permalink:"/docs/server-api/admin-apis/mentors"},next:{title:"Videos",permalink:"/docs/server-api/admin-apis/videos"}},u={},c=[{value:"List Attempts",id:"list-attempts",level:2},{value:"Examples",id:"examples",level:4},{value:"Get A Single Attempt",id:"get-a-single-attempt",level:2},{value:"HTTP Request",id:"http-request",level:4},{value:"URL Parameters",id:"url-parameters",level:4},{value:"Response",id:"response",level:4},{value:"Get Student Exam Responses",id:"get-student-exam-responses",level:2},{value:"HTTP Request",id:"http-request-1",level:4},{value:"URL Parameters",id:"url-parameters-1",level:4},{value:"Response",id:"response-1",level:4},{value:"Get Chapter Content Attempts",id:"get-chapter-content-attempts",level:2},{value:"HTTP Request",id:"http-request-2",level:4},{value:"Query Parameters",id:"query-parameters",level:4},{value:"Response",id:"response-2",level:4},{value:"Get Video Conference Attempts",id:"get-video-conference-attempts",level:2},{value:"HTTP Request",id:"http-request-3",level:4},{value:"URL Parameters",id:"url-parameters-2",level:4},{value:"Example",id:"example",level:4},{value:"Response Fields",id:"response-fields",level:4},{value:"Response",id:"response-3",level:4}],d={toc:c};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"attempts"},"Attempts"),(0,r.kt)("admonition",{type:"important"},(0,r.kt)("p",{parentName:"admonition"},"Admin APIs require authorization token with admin privileges. You check the following link to generate authorization token. You need to provide admin username and password to generate token with admin privileges")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://testpress.github.io/testpress_docs/docs/intro/"},"Authentication")),(0,r.kt)("p",null,"All operations related to user attempt can be done using the following end points."),(0,r.kt)("h2",{id:"list-attempts"},"List Attempts"),(0,r.kt)("p",null,"This endpoint returns all attempts. Attempts can be filtered based on user or exams"),(0,r.kt)("details",null,(0,r.kt)("summary",null," ",(0,r.kt)("b",null,"Get")," https:// institute_url /api/v2.5/admin/attempts",(0,r.kt)("br",null),"Attempts List API "),(0,r.kt)("p",null," This endpoint returns all attempts."),(0,r.kt)("h4",null," Parameters"),(0,r.kt)("h4",null," Query"),(0,r.kt)("table",null,(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"ordering"),(0,r.kt)("td",null,"string"),(0,r.kt)("td",null,"This will sort the results date Oldest started attempts will be displayed first ",(0,r.kt)("br",null),"-date - Recently started attempts will be displayed first correctanswers_count ",(0,r.kt)("br",null),"- Attempts with least correct answers will be displayed first ",(0,r.kt)("br",null),"-correct answers_count ",(0,r.kt)("br",null),"- Attempts with more correct answers will be displayed first incorrectLanswers_count ",(0,r.kt)("br",null),"- Attempts with least incorrect answers will be displayed first ",(0,r.kt)("br",null),"-incorrectanswers_count Attempts with more incorrect answerss will be displayed first unanswered_count ",(0,r.kt)("br",null),"- Attempts with least unanswered answers will be displayed first -unanswered_count ",(0,r.kt)("br",null),"- Attempts with more unanswered will be displayed first")),(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"state"),(0,r.kt)("td",null,"number"),(0,r.kt)("td",null,"This will filter attempts based on the following states",(0,r.kt)("br",null),"0-Running Attempts",(0,r.kt)("br",null),"1- Completed Attempts",(0,r.kt)("br",null),"3-Not started")),(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"date_1"),(0,r.kt)("td",null,"string"),(0,r.kt)("td",null,"This will display all attempts which started before this date")),(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"date_0"),(0,r.kt)("td",null,"string"),(0,r.kt)("td",null,"This will display all attempts which started after this date")),(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"Users"),(0,r.kt)("td",null,"integer"),(0,r.kt)("td",null,"To get attempts of an user. Value should be user id",(0,r.kt)("br",null),"Ex: users=1")),(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"exams"),(0,r.kt)("td",null,"integer"),(0,r.kt)("td",null,"To filter attempts by exam. Value should be exam id exams",(0,r.kt)("br",null),"Ex: exams=3"))),(0,r.kt)("h4",null,"Responses"),(0,r.kt)("details",null,(0,r.kt)("summary",null," 200 "),(0,r.kt)("pre",null,(0,r.kt)("p",null,'{\n"count":1,\n"next":"',(0,r.kt)("a",{parentName:"p",href:"https://sandbox.testpress.in/api/v2.5/admin/attempts/?page=2%22"},'https://sandbox.testpress.in/api/v2.5/admin/attempts/?page=2"'),',\n"previous":null,\n"per_page":200,\n"results":','[\n{\nid: 68701,\ndate: "2021-03-16T03:59:21.860924Z",\nexam_id: 133,\nuser_id: 143,\nemail: null,\nname: null,\nphone: null,\ncorrect_answers_count: 220,\nincorrect_answers_count: 20,\nunanswered_count: 200,\nscore: "90.00",\npercentage: 0,\ntime_taken: "0:00:00",\nremaining_time: null,\nresult: "Not taken",\nstate: "Completed",\nlast_started_time: null,\nlast_answer_updated_time: null,\nspeed: 0,\nexam_url: "https://sandbox.testpress.in/api/v2.5/admin/exams/133/",\nuser_url: "https://sandbox.testpress.in/api/v2.5/admin/users/133/"\n}]',"\n}")))),(0,r.kt)("h4",{id:"examples"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"/api/v2.5/admin/attempts/?exams=5")," - This will display attempt of exam with id 5"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"/api/v2.5/admin/attempts/?users=1&exams=2")," - This will display attempts of exam whose id is 2 for the user id 1"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"/api/v2.5/admin/attempts/?date_0=2020-01-11&date_1=2021-02-02&ordering=date")," - This will display attempts that are attempted between 11/1/2020 and 2/2/2021. Oldest attempted exams will be displayed first")),(0,r.kt)("h2",{id:"get-a-single-attempt"},"Get A Single Attempt"),(0,r.kt)("p",null,"This endpoint retrieves a single attempt."),(0,r.kt)("h4",{id:"http-request"},"HTTP Request"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"GET /api/v2.5/admin/attempts//\n")),(0,r.kt)("h4",{id:"url-parameters"},"URL Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Parameter"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"The unique id of the attempt to retrieve")))),(0,r.kt)(l.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"bash",label:"cURL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"curl --request GET \\\n --url http://demo.testpress.in/api/v2.5/admin/attempts/125894/ \\\n --header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \\\n --header 'cache-control: no-cache'\n\n"))),(0,r.kt)(s.Z,{value:"rb",label:"Ruby",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rb"},"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"http://demo.testpress.in/api/v2.5/admin/attempts/125894/\")\n\nhttp = Net::HTTP.new(url.host, url.port)\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw'\nrequest[\"cache-control\"] = 'no-cache'\n\nresponse = http.request(request)\nputs response.read_body\n"))),(0,r.kt)(s.Z,{value:"py",label:"Python",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import requests\n\nurl = "http://demo.testpress.in/api/v2.5/admin/attempts/125894/"\n\nheaders = {\n \'authorization\': "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw",\n \'cache-control\': "no-cache"\n }\n\nresponse = requests.request("GET", url, headers=headers)\n\nprint(response.text)\n\n')))),(0,r.kt)("h4",{id:"response"},"Response"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "id": 1,\n "date": "2023-01-23T11:35:37.930389+05:30",\n "exam_id": 2,\n "user_id": 2,\n "email": "hariharan@testpress.in",\n "name": null,\n "phone": null,\n "correct_answers_count": 0,\n "incorrect_answers_count": 1,\n "unanswered_count": 79,\n "score": "0.00",\n "percentage": 0,\n "percentile": 100.0,\n "time_taken": "2:47:53.076906",\n "remaining_time": "0:00:00",\n "result": "Fail",\n "state": "Completed",\n "last_started_time": "2023-04-02T15:27:46.453786+05:30",\n "last_answer_updated_time": "2023-04-02T15:27:59.639308+05:30",\n "speed": 0,\n "exam_url": "http://demo.tespress.in/api/v2.5/admin/exams/2/",\n "user_url": "http://demo.tespress.in/api/v2.5/admin/users/2/",\n "username": "admin",\n "sections": [\n {\n "id": 1,\n "order": 0,\n "section_id": 2,\n "time_taken": "0:00:00",\n "correct_answers_count": 0,\n "incorrect_answers_count": 0,\n "unanswered_count": 20,\n "score": "0.00"\n },\n {\n "id": 2,\n "order": 1,\n "section_id": 3,\n "time_taken": "0:00:00",\n "correct_answers_count": 0,\n "incorrect_answers_count": 1,\n "unanswered_count": 20,\n "score": "0.00"\n },\n {\n "id": 3,\n "order": 2,\n "section_id": 4,\n "time_taken": "0:00:00",\n "correct_answers_count": 0,\n "incorrect_answers_count": 0,\n "unanswered_count": 20,\n "score": "0.00"\n },\n {\n "id": 4,\n "order": 3,\n "section_id": 5,\n "time_taken": "0:00:00",\n "correct_answers_count": 0,\n "incorrect_answers_count": 0,\n "unanswered_count": 19,\n "score": "0.00"\n }\n ],\n "subject_stats": [\n {\n "subject_id": 1,\n "subject_name": "Geography",\n "total_count": 64,\n "correct_answers_count": 0,\n "unanswered_count": 63,\n "incorrect_answers_count": 1,\n "parent_subject_id": null,\n "is_leaf": true,\n "score": "0.00",\n "partial_correct_answers_count": 0\n },\n {\n "subject_id": 2,\n "subject_name": "Current affairs",\n "total_count": 12,\n "correct_answers_count": 0,\n "unanswered_count": 12,\n "incorrect_answers_count": 0,\n "parent_subject_id": null,\n "is_leaf": true,\n "score": "0.00",\n "partial_correct_answers_count": 0\n },\n {\n "subject_id": null,\n "subject_name": "History",\n "total_count": 4,\n "correct_answers_count": 0,\n "unanswered_count": 4,\n "incorrect_answers_count": 0,\n "parent_subject_id": null,\n "is_leaf": true,\n "score": "0.00",\n "partial_correct_answers_count": 0\n }\n ],\n "difficulty_level_stats": {\n "easy": {\n "correct_answers_count": 0,\n "incorrect_answers_count": 1,\n "partial_correct_answers_count": 0,\n "unanswered_count": 69,\n "total_count": 70\n },\n "medium": {\n "correct_answers_count": 0,\n "incorrect_answers_count": 5,\n "partial_correct_answers_count": 0,\n "unanswered_count": 5,\n "total_count": 10\n }\n },\n "institute_attempt_id": 100101\n}\n\n')),(0,r.kt)("h2",{id:"get-student-exam-responses"},"Get Student Exam Responses"),(0,r.kt)("p",null,"This endpoint retreives the student responses for a particular exam."),(0,r.kt)("h4",{id:"http-request-1"},"HTTP Request"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"GET /api/v3/admin/attempts//user_answers/\n")),(0,r.kt)("h4",{id:"url-parameters-1"},"URL Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Parameter"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"The unique id of the attempt to retrieve the student responses.")))),(0,r.kt)(l.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"bash",label:"cURL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"curl --request GET \\\n --url http://demo.testpress.in/api/v3/admin/attempts/423/user_answers/ \\\n --header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \\\n --header 'cache-control: no-cache'\n\n"))),(0,r.kt)(s.Z,{value:"rb",label:"Ruby",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rb"},"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"http://demo.testpress.in/api/v3/admin/attempts/423/user_answers/\")\n\nhttp = Net::HTTP.new(url.host, url.port)\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw'\nrequest[\"cache-control\"] = 'no-cache'\n\nresponse = http.request(request)\nputs response.read_body\n"))),(0,r.kt)(s.Z,{value:"py",label:"Python",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import requests\n\nurl = "http://demo.testpress.in/api/v3/admin/attempts/423/user_answers/"\n\nheaders = {\n \'authorization\': "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw",\n \'cache-control\': "no-cache"\n }\n\nresponse = requests.request("GET", url, headers=headers)\n\nprint(response.text)\n\n')))),(0,r.kt)("h4",{id:"response-1"},"Response"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "count": 1,\n "next": null,\n "previous": null,\n "per_page": 250,\n "results": {\n "user_answers": [\n {\n "id": 476,\n "exam_question_id": 39,\n "selected_answers": [\n 6\n ],\n "result": "Incorrect",\n "duration": 5,\n "review": false,\n "guessed": null\n },\n ],\n "exam_questions": [\n {\n \n "id": 39,\n "question_id": 2,\n "section_id": 90,\n "question_html": "\\n

where is Paris ?

",\n "type": "MCQ, Single Correct",\n "marks": "1.00",\n "negative_marks": "0.00",\n "partial_marks": null,\n "direction": null,\n "answers": [\n {\n "id": 5,\n "text_html": "\\n

France

"\n },\n {\n "id": 6,\n "text_html": "\\n

Italy

"\n },\n {\n "id": 7,\n "text_html": "\\n

Belgium

"\n },\n {\n "id": 8,\n "text_html": "\\n

Germany

"\n }\n ],\n "difficulty_level": null,\n "order": 0,\n "is_bonus": false,\n "exam_id": 46\n },\n \n ]\n }\n}\n\n\n')),(0,r.kt)("h2",{id:"get-chapter-content-attempts"},"Get Chapter Content Attempts"),(0,r.kt)("p",null,"This endpoint retrieves the chapter content attempts list for all users."),(0,r.kt)("h4",{id:"http-request-2"},"HTTP Request"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"GET /api/v3/admin/chapter-content-attempts/\n")),(0,r.kt)("h4",{id:"query-parameters"},"Query Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Parameter"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"user_ids"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Unique user ID")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"chapter_ids"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Unique chapter ID")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"course_ids"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Unique course ID")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"chapter_content_ids"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Unique chapter content ID")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"exam_id"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Unique exam ID")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"content_type"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Type of content")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"state"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Status of the attempt")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"completed_date"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"date in the format yyyy-mm-dd")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"completed_before"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"date in the format yyyy-mm-dd")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"completed_after"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"date in the format yyyy-mm-dd")))),(0,r.kt)(l.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"bash",label:"cURL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"curl --request GET \\\n --url http://demo.testpress.in/api/v3/admin/chapter-content-attempts/ \\\n --header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \\\n --header 'cache-control: no-cache'\n\n"))),(0,r.kt)(s.Z,{value:"rb",label:"Ruby",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rb"},"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"http://demo.testpress.in/api/v3/admin/chapter-content-attempts/\")\n\nhttp = Net::HTTP.new(url.host, url.port)\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw'\nrequest[\"cache-control\"] = 'no-cache'\n\nresponse = http.request(request)\nputs response.read_body\n"))),(0,r.kt)(s.Z,{value:"py",label:"Python",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import requests\n\nurl = "http://demo.testpress.in/api/v3/admin/chapter-content-attempts/"\n\nheaders = {\n \'authorization\': "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw",\n \'cache-control\': "no-cache"\n }\n\nresponse = requests.request("GET", url, headers=headers)\n\nprint(response.text)\n\n')))),(0,r.kt)("h4",{id:"response-2"},"Response"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "count": 1,\n "next": null,\n "previous": null,\n "per_page": 250,\n "results": {\n "content_attempts": [\n {\n "id": 764,\n "user_id": 9,\n "course_id": 8,\n "chapter_id": 33,\n "chapter_content_id": 127,\n "content_type": "video",\n "state": "Started",\n "remaining_time": null,\n "assessment_id": null,\n "user_video_conference_id": null,\n "user_video_id": 55,\n "user_live_stream_id": null,\n "user_content_id": null,\n "user_attachment_id": null,\n "created": "2024-07-15T18:49:52.059055+05:30",\n "completed_on": null\n },\n ],\n "user_videos": [\n {\n "id": 55,\n "video_id": 18,\n "created": "2024-07-15T18:38:42.853855+05:30",\n "watched_percentage": 0,\n "remaining_duration": null,\n "state": "Started",\n "is_live_class_recording": false\n }\n \n ]\n }\n}\n')),(0,r.kt)("h2",{id:"get-video-conference-attempts"},"Get Video Conference Attempts"),(0,r.kt)("p",null,"This endpoint retrieves the details of attempts for a video conference."),(0,r.kt)("h4",{id:"http-request-3"},"HTTP Request"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"GET /api/v3/admin/attempts//video-conference/\n")),(0,r.kt)("h4",{id:"url-parameters-2"},"URL Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Parameter"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"The unique id of the video conference")))),(0,r.kt)("h4",{id:"example"},"Example"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"/api/v3/admin/attempts/12/video-conference/")),(0,r.kt)("p",null,"This endpoint will retrieve the details of attempts for the video conference with ID 12."),(0,r.kt)("h4",{id:"response-fields"},"Response Fields"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"name"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Name of the user")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"email"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Email of the user")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"joined_time"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Time of joining the video conference in ISO 8601 format")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"leave_time"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Time of leaving the video conference in ISO 8601 format")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"duration"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration of attendance in seconds")))),(0,r.kt)(l.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"bash",label:"cURL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"curl --request GET \\\n --url http://demo.testpress.in/api/v3/admin/attempts/12/video-conference/ \\\n --header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \\\n --header 'cache-control: no-cache'\n\n"))),(0,r.kt)(s.Z,{value:"rb",label:"Ruby",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rb"},"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"http://demo.testpress.in/api/v3/admin/attempts/12/video-conference/\")\n\nhttp = Net::HTTP.new(url.host, url.port)\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw'\nrequest[\"cache-control\"] = 'no-cache'\n\nresponse = http.request(request)\nputs response.read_body\n"))),(0,r.kt)(s.Z,{value:"py",label:"Python",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import requests\n\nurl = "http://demo.testpress.in/api/v3/admin/attempts/12/video-conference/"\n\nheaders = {\n \'authorization\': "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw",\n \'cache-control\': "no-cache"\n }\n\nresponse = requests.request("GET", url, headers=headers)\n\nprint(response.text)\n\n')))),(0,r.kt)("h4",{id:"response-3"},"Response"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "count": 2,\n "next": null,\n "previous": null,\n "per_page": 20,\n "results": [\n {\n "name": "deva",\n "email": "deva@testpress.in",\n "join_time": "2024-06-10T16:20:26+05:30",\n "leave_time": "2024-06-10T16:22:26+05:30",\n "duration": 120\n },\n {\n "name": "alwin",\n "email": "alwin@testpress.in",\n "join_time": "2024-06-10T16:19:55+05:30",\n "leave_time": "2024-06-10T16:22:27+05:30",\n "duration": 152\n }\n ]\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/55ccdc72.fa5d934e.js b/assets/js/55ccdc72.fa5d934e.js deleted file mode 100644 index 8a1937d..0000000 --- a/assets/js/55ccdc72.fa5d934e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunktestpress_docs=self.webpackChunktestpress_docs||[]).push([[9251],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),o=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},u=function(e){var t=o(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=o(n),m=r,k=d["".concat(p,".").concat(m)]||d[m]||c[m]||l;return n?a.createElement(k,s(s({ref:t},u),{},{components:n})):a.createElement(k,s({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,s=new Array(l);s[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var o=2;o{n.d(t,{Z:()=>s});var a=n(7294),r=n(6010);const l="tabItem_Ymn6";function s(e){let{children:t,hidden:n,className:s}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(l,s),hidden:n},t)}},5488:(e,t,n)=>{n.d(t,{Z:()=>m});var a=n(7462),r=n(7294),l=n(6010),s=n(2389),i=n(7392),p=n(7094),o=n(2466);const u="tabList__CuJ",c="tabItem_LNqP";function d(e){var t;const{lazy:n,block:s,defaultValue:d,values:m,groupId:k,className:b}=e,h=r.Children.map(e.children,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})),_=m??h.map((e=>{let{props:{value:t,label:n,attributes:a}}=e;return{value:t,label:n,attributes:a}})),y=(0,i.l)(_,((e,t)=>e.value===t.value));if(y.length>0)throw new Error(`Docusaurus error: Duplicate values "${y.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`);const g=null===d?d:d??(null==(t=h.find((e=>e.props.default)))?void 0:t.props.value)??h[0].props.value;if(null!==g&&!_.some((e=>e.value===g)))throw new Error(`Docusaurus error: The has a defaultValue "${g}" but none of its children has the corresponding value. Available values are: ${_.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);const{tabGroupChoices:N,setTabGroupChoices:v}=(0,p.U)(),[f,w]=(0,r.useState)(g),I=[],{blockElementScrollPositionUntilNextRender:T}=(0,o.o5)();if(null!=k){const e=N[k];null!=e&&e!==f&&_.some((t=>t.value===e))&&w(e)}const R=e=>{const t=e.currentTarget,n=I.indexOf(t),a=_[n].value;a!==f&&(T(t),w(a),null!=k&&v(k,String(a)))},C=e=>{var t;let n=null;switch(e.key){case"Enter":R(e);break;case"ArrowRight":{const t=I.indexOf(e.currentTarget)+1;n=I[t]??I[0];break}case"ArrowLeft":{const t=I.indexOf(e.currentTarget)-1;n=I[t]??I[I.length-1];break}}null==(t=n)||t.focus()};return r.createElement("div",{className:(0,l.Z)("tabs-container",u)},r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":s},b)},_.map((e=>{let{value:t,label:n,attributes:s}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:f===t?0:-1,"aria-selected":f===t,key:t,ref:e=>I.push(e),onKeyDown:C,onClick:R},s,{className:(0,l.Z)("tabs__item",c,null==s?void 0:s.className,{"tabs__item--active":f===t})}),n??t)}))),n?(0,r.cloneElement)(h.filter((e=>e.props.value===f))[0],{className:"margin-top--md"}):r.createElement("div",{className:"margin-top--md"},h.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==f})))))}function m(e){const t=(0,s.Z)();return r.createElement(d,(0,a.Z)({key:String(t)},e))}},679:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var a=n(7462),r=(n(7294),n(3905)),l=n(5488),s=n(5162);const i={sidebar_position:4},p="Attempts",o={unversionedId:"server-api/admin-apis/attempts",id:"server-api/admin-apis/attempts",title:"Attempts",description:"Admin APIs require authorization token with admin privileges. You check the following link to generate authorization token. You need to provide admin username and password to generate token with admin privileges",source:"@site/docs/server-api/admin-apis/attempts.md",sourceDirName:"server-api/admin-apis",slug:"/server-api/admin-apis/attempts",permalink:"/docs/server-api/admin-apis/attempts",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"serverAPISidebar",previous:{title:"Mentors",permalink:"/docs/server-api/admin-apis/mentors"},next:{title:"Videos",permalink:"/docs/server-api/admin-apis/videos"}},u={},c=[{value:"List Attempts",id:"list-attempts",level:2},{value:"Examples",id:"examples",level:4},{value:"Get A Single Attempt",id:"get-a-single-attempt",level:2},{value:"HTTP Request",id:"http-request",level:4},{value:"URL Parameters",id:"url-parameters",level:4},{value:"Response",id:"response",level:4},{value:"Get Chapter Content Attempts",id:"get-chapter-content-attempts",level:2},{value:"HTTP Request",id:"http-request-1",level:4},{value:"Query Parameters",id:"query-parameters",level:4},{value:"Response",id:"response-1",level:4},{value:"Get Video Conference Attempts",id:"get-video-conference-attempts",level:2},{value:"HTTP Request",id:"http-request-2",level:4},{value:"URL Parameters",id:"url-parameters-1",level:4},{value:"Example",id:"example",level:4},{value:"Response Fields",id:"response-fields",level:4},{value:"Response",id:"response-2",level:4}],d={toc:c};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"attempts"},"Attempts"),(0,r.kt)("admonition",{type:"important"},(0,r.kt)("p",{parentName:"admonition"},"Admin APIs require authorization token with admin privileges. You check the following link to generate authorization token. You need to provide admin username and password to generate token with admin privileges")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://testpress.github.io/testpress_docs/docs/intro/"},"Authentication")),(0,r.kt)("p",null,"All operations related to user attempt can be done using the following end points."),(0,r.kt)("h2",{id:"list-attempts"},"List Attempts"),(0,r.kt)("p",null,"This endpoint returns all attempts. Attempts can be filtered based on user or exams"),(0,r.kt)("details",null,(0,r.kt)("summary",null," ",(0,r.kt)("b",null,"Get")," https:// institute_url /api/v2.5/admin/attempts",(0,r.kt)("br",null),"Attempts List API "),(0,r.kt)("p",null," This endpoint returns all attempts."),(0,r.kt)("h4",null," Parameters"),(0,r.kt)("h4",null," Query"),(0,r.kt)("table",null,(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"ordering"),(0,r.kt)("td",null,"string"),(0,r.kt)("td",null,"This will sort the results date Oldest started attempts will be displayed first ",(0,r.kt)("br",null),"-date - Recently started attempts will be displayed first correctanswers_count ",(0,r.kt)("br",null),"- Attempts with least correct answers will be displayed first ",(0,r.kt)("br",null),"-correct answers_count ",(0,r.kt)("br",null),"- Attempts with more correct answers will be displayed first incorrectLanswers_count ",(0,r.kt)("br",null),"- Attempts with least incorrect answers will be displayed first ",(0,r.kt)("br",null),"-incorrectanswers_count Attempts with more incorrect answerss will be displayed first unanswered_count ",(0,r.kt)("br",null),"- Attempts with least unanswered answers will be displayed first -unanswered_count ",(0,r.kt)("br",null),"- Attempts with more unanswered will be displayed first")),(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"state"),(0,r.kt)("td",null,"number"),(0,r.kt)("td",null,"This will filter attempts based on the following states",(0,r.kt)("br",null),"0-Running Attempts",(0,r.kt)("br",null),"1- Completed Attempts",(0,r.kt)("br",null),"3-Not started")),(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"date_1"),(0,r.kt)("td",null,"string"),(0,r.kt)("td",null,"This will display all attempts which started before this date")),(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"date_0"),(0,r.kt)("td",null,"string"),(0,r.kt)("td",null,"This will display all attempts which started after this date")),(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"Users"),(0,r.kt)("td",null,"integer"),(0,r.kt)("td",null,"To get attempts of an user. Value should be user id",(0,r.kt)("br",null),"Ex: users=1")),(0,r.kt)("tr",null,(0,r.kt)("td",{"text-align":"left"},"exams"),(0,r.kt)("td",null,"integer"),(0,r.kt)("td",null,"To filter attempts by exam. Value should be exam id exams",(0,r.kt)("br",null),"Ex: exams=3"))),(0,r.kt)("h4",null,"Responses"),(0,r.kt)("details",null,(0,r.kt)("summary",null," 200 "),(0,r.kt)("pre",null,(0,r.kt)("p",null,'{\n"count":1,\n"next":"',(0,r.kt)("a",{parentName:"p",href:"https://sandbox.testpress.in/api/v2.5/admin/attempts/?page=2%22"},'https://sandbox.testpress.in/api/v2.5/admin/attempts/?page=2"'),',\n"previous":null,\n"per_page":200,\n"results":','[\n{\nid: 68701,\ndate: "2021-03-16T03:59:21.860924Z",\nexam_id: 133,\nuser_id: 143,\nemail: null,\nname: null,\nphone: null,\ncorrect_answers_count: 220,\nincorrect_answers_count: 20,\nunanswered_count: 200,\nscore: "90.00",\npercentage: 0,\ntime_taken: "0:00:00",\nremaining_time: null,\nresult: "Not taken",\nstate: "Completed",\nlast_started_time: null,\nlast_answer_updated_time: null,\nspeed: 0,\nexam_url: "https://sandbox.testpress.in/api/v2.5/admin/exams/133/",\nuser_url: "https://sandbox.testpress.in/api/v2.5/admin/users/133/"\n}]',"\n}")))),(0,r.kt)("h4",{id:"examples"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"/api/v2.5/admin/attempts/?exams=5")," - This will display attempt of exam with id 5"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"/api/v2.5/admin/attempts/?users=1&exams=2")," - This will display attempts of exam whose id is 2 for the user id 1"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"/api/v2.5/admin/attempts/?date_0=2020-01-11&date_1=2021-02-02&ordering=date")," - This will display attempts that are attempted between 11/1/2020 and 2/2/2021. Oldest attempted exams will be displayed first")),(0,r.kt)("h2",{id:"get-a-single-attempt"},"Get A Single Attempt"),(0,r.kt)("p",null,"This endpoint retrieves a single attempt."),(0,r.kt)("h4",{id:"http-request"},"HTTP Request"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"GET /api/v2.5/admin/attempts//\n")),(0,r.kt)("h4",{id:"url-parameters"},"URL Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Parameter"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"The unique id of the attempt to retrieve")))),(0,r.kt)(l.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"bash",label:"cURL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"curl --request GET \\\n --url http://demo.testpress.in/api/v2.5/admin/attempts/125894/ \\\n --header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \\\n --header 'cache-control: no-cache'\n\n"))),(0,r.kt)(s.Z,{value:"rb",label:"Ruby",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rb"},"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"http://demo.testpress.in/api/v2.5/admin/attempts/125894/\")\n\nhttp = Net::HTTP.new(url.host, url.port)\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw'\nrequest[\"cache-control\"] = 'no-cache'\n\nresponse = http.request(request)\nputs response.read_body\n"))),(0,r.kt)(s.Z,{value:"py",label:"Python",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import requests\n\nurl = "http://demo.testpress.in/api/v2.5/admin/attempts/125894/"\n\nheaders = {\n \'authorization\': "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw",\n \'cache-control\': "no-cache"\n }\n\nresponse = requests.request("GET", url, headers=headers)\n\nprint(response.text)\n\n')))),(0,r.kt)("h4",{id:"response"},"Response"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "id": 1,\n "date": "2023-01-23T11:35:37.930389+05:30",\n "exam_id": 2,\n "user_id": 2,\n "email": "hariharan@testpress.in",\n "name": null,\n "phone": null,\n "correct_answers_count": 0,\n "incorrect_answers_count": 1,\n "unanswered_count": 79,\n "score": "0.00",\n "percentage": 0,\n "percentile": 100.0,\n "time_taken": "2:47:53.076906",\n "remaining_time": "0:00:00",\n "result": "Fail",\n "state": "Completed",\n "last_started_time": "2023-04-02T15:27:46.453786+05:30",\n "last_answer_updated_time": "2023-04-02T15:27:59.639308+05:30",\n "speed": 0,\n "exam_url": "http://demo.tespress.in/api/v2.5/admin/exams/2/",\n "user_url": "http://demo.tespress.in/api/v2.5/admin/users/2/",\n "username": "admin",\n "sections": [\n {\n "id": 1,\n "order": 0,\n "section_id": 2,\n "time_taken": "0:00:00",\n "correct_answers_count": 0,\n "incorrect_answers_count": 0,\n "unanswered_count": 20,\n "score": "0.00"\n },\n {\n "id": 2,\n "order": 1,\n "section_id": 3,\n "time_taken": "0:00:00",\n "correct_answers_count": 0,\n "incorrect_answers_count": 1,\n "unanswered_count": 20,\n "score": "0.00"\n },\n {\n "id": 3,\n "order": 2,\n "section_id": 4,\n "time_taken": "0:00:00",\n "correct_answers_count": 0,\n "incorrect_answers_count": 0,\n "unanswered_count": 20,\n "score": "0.00"\n },\n {\n "id": 4,\n "order": 3,\n "section_id": 5,\n "time_taken": "0:00:00",\n "correct_answers_count": 0,\n "incorrect_answers_count": 0,\n "unanswered_count": 19,\n "score": "0.00"\n }\n ],\n "subject_stats": [\n {\n "subject_id": 1,\n "subject_name": "Geography",\n "total_count": 64,\n "correct_answers_count": 0,\n "unanswered_count": 63,\n "incorrect_answers_count": 1,\n "parent_subject_id": null,\n "is_leaf": true,\n "score": "0.00",\n "partial_correct_answers_count": 0\n },\n {\n "subject_id": 2,\n "subject_name": "Current affairs",\n "total_count": 12,\n "correct_answers_count": 0,\n "unanswered_count": 12,\n "incorrect_answers_count": 0,\n "parent_subject_id": null,\n "is_leaf": true,\n "score": "0.00",\n "partial_correct_answers_count": 0\n },\n {\n "subject_id": null,\n "subject_name": "History",\n "total_count": 4,\n "correct_answers_count": 0,\n "unanswered_count": 4,\n "incorrect_answers_count": 0,\n "parent_subject_id": null,\n "is_leaf": true,\n "score": "0.00",\n "partial_correct_answers_count": 0\n }\n ],\n "difficulty_level_stats": {\n "easy": {\n "correct_answers_count": 0,\n "incorrect_answers_count": 1,\n "partial_correct_answers_count": 0,\n "unanswered_count": 69,\n "total_count": 70\n },\n "medium": {\n "correct_answers_count": 0,\n "incorrect_answers_count": 5,\n "partial_correct_answers_count": 0,\n "unanswered_count": 5,\n "total_count": 10\n }\n },\n "institute_attempt_id": 100101\n}\n\n')),(0,r.kt)("h2",{id:"get-chapter-content-attempts"},"Get Chapter Content Attempts"),(0,r.kt)("p",null,"This endpoint retrieves the chapter content attempts list for all users."),(0,r.kt)("h4",{id:"http-request-1"},"HTTP Request"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"GET /api/v3/admin/chapter-content-attempts/\n")),(0,r.kt)("h4",{id:"query-parameters"},"Query Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Parameter"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"user_ids"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Unique user ID")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"chapter_ids"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Unique chapter ID")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"course_ids"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Unique course ID")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"chapter_content_ids"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Unique chapter content ID")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"exam_id"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Unique exam ID")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"content_type"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Type of content")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"state"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Status of the attempt")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"completed_date"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"date in the format yyyy-mm-dd")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"completed_before"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"date in the format yyyy-mm-dd")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"completed_after"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"date in the format yyyy-mm-dd")))),(0,r.kt)(l.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"bash",label:"cURL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"curl --request GET \\\n --url http://demo.testpress.in/api/v3/admin/chapter-content-attempts/ \\\n --header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \\\n --header 'cache-control: no-cache'\n\n"))),(0,r.kt)(s.Z,{value:"rb",label:"Ruby",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rb"},"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"http://demo.testpress.in/api/v3/admin/chapter-content-attempts/\")\n\nhttp = Net::HTTP.new(url.host, url.port)\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw'\nrequest[\"cache-control\"] = 'no-cache'\n\nresponse = http.request(request)\nputs response.read_body\n"))),(0,r.kt)(s.Z,{value:"py",label:"Python",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import requests\n\nurl = "http://demo.testpress.in/api/v3/admin/chapter-content-attempts/"\n\nheaders = {\n \'authorization\': "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw",\n \'cache-control\': "no-cache"\n }\n\nresponse = requests.request("GET", url, headers=headers)\n\nprint(response.text)\n\n')))),(0,r.kt)("h4",{id:"response-1"},"Response"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "count": 1,\n "next": null,\n "previous": null,\n "per_page": 250,\n "results": {\n "content_attempts": [\n {\n "id": 764,\n "user_id": 9,\n "course_id": 8,\n "chapter_id": 33,\n "chapter_content_id": 127,\n "content_type": "video",\n "state": "Started",\n "remaining_time": null,\n "assessment_id": null,\n "user_video_conference_id": null,\n "user_video_id": 55,\n "user_live_stream_id": null,\n "user_content_id": null,\n "user_attachment_id": null,\n "created": "2024-07-15T18:49:52.059055+05:30",\n "completed_on": null\n },\n ],\n "user_videos": [\n {\n "id": 55,\n "video_id": 18,\n "created": "2024-07-15T18:38:42.853855+05:30",\n "watched_percentage": 0,\n "remaining_duration": null,\n "state": "Started",\n "is_live_class_recording": false\n }\n \n ]\n }\n}\n')),(0,r.kt)("h2",{id:"get-video-conference-attempts"},"Get Video Conference Attempts"),(0,r.kt)("p",null,"This endpoint retrieves the details of attempts for a video conference."),(0,r.kt)("h4",{id:"http-request-2"},"HTTP Request"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"GET /api/v3/admin/attempts//video-conference/\n")),(0,r.kt)("h4",{id:"url-parameters-1"},"URL Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Parameter"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"The unique id of the video conference")))),(0,r.kt)("h4",{id:"example"},"Example"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"/api/v3/admin/attempts/12/video-conference/")),(0,r.kt)("p",null,"This endpoint will retrieve the details of attempts for the video conference with ID 12."),(0,r.kt)("h4",{id:"response-fields"},"Response Fields"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"name"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Name of the user")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"email"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Email of the user")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"joined_time"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Time of joining the video conference in ISO 8601 format")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"leave_time"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Time of leaving the video conference in ISO 8601 format")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"duration"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration of attendance in seconds")))),(0,r.kt)(l.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"bash",label:"cURL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"curl --request GET \\\n --url http://demo.testpress.in/api/v3/admin/attempts/12/video-conference/ \\\n --header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \\\n --header 'cache-control: no-cache'\n\n"))),(0,r.kt)(s.Z,{value:"rb",label:"Ruby",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rb"},"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"http://demo.testpress.in/api/v3/admin/attempts/12/video-conference/\")\n\nhttp = Net::HTTP.new(url.host, url.port)\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw'\nrequest[\"cache-control\"] = 'no-cache'\n\nresponse = http.request(request)\nputs response.read_body\n"))),(0,r.kt)(s.Z,{value:"py",label:"Python",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import requests\n\nurl = "http://demo.testpress.in/api/v3/admin/attempts/12/video-conference/"\n\nheaders = {\n \'authorization\': "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw",\n \'cache-control\': "no-cache"\n }\n\nresponse = requests.request("GET", url, headers=headers)\n\nprint(response.text)\n\n')))),(0,r.kt)("h4",{id:"response-2"},"Response"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "count": 2,\n "next": null,\n "previous": null,\n "per_page": 20,\n "results": [\n {\n "name": "deva",\n "email": "deva@testpress.in",\n "join_time": "2024-06-10T16:20:26+05:30",\n "leave_time": "2024-06-10T16:22:26+05:30",\n "duration": 120\n },\n {\n "name": "alwin",\n "email": "alwin@testpress.in",\n "join_time": "2024-06-10T16:19:55+05:30",\n "leave_time": "2024-06-10T16:22:27+05:30",\n "duration": 152\n }\n ]\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.c487b516.js b/assets/js/runtime~main.9d207e6c.js similarity index 98% rename from assets/js/runtime~main.c487b516.js rename to assets/js/runtime~main.9d207e6c.js index ea76d10..5e6199d 100644 --- a/assets/js/runtime~main.c487b516.js +++ b/assets/js/runtime~main.9d207e6c.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,c,t,r,f={},b={};function d(e){var a=b[e];if(void 0!==a)return a.exports;var c=b[e]={exports:{}};return f[e].call(c.exports,c,c.exports,d),c.exports}d.m=f,e=[],d.O=(a,c,t,r)=>{if(!c){var f=1/0;for(i=0;i=r)&&Object.keys(d.O).every((e=>d.O[e](c[o])))?c.splice(o--,1):(b=!1,r0&&e[i-1][2]>r;i--)e[i]=e[i-1];e[i]=[c,t,r]},d.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return d.d(a,{a:a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var r=Object.create(null);d.r(r);var f={};a=a||[null,c({}),c([]),c(c)];for(var b=2&t&&e;"object"==typeof b&&!~a.indexOf(b);b=c(b))Object.getOwnPropertyNames(b).forEach((a=>f[a]=()=>e[a]));return f.default=()=>e,d.d(r,f),r},d.d=(e,a)=>{for(var c in a)d.o(a,c)&&!d.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce(((a,c)=>(d.f[c](e,a),a)),[])),d.u=e=>"assets/js/"+({53:"935f2afb",691:"85c7fbe8",727:"40bac974",911:"42363dad",1134:"6bc9270a",1809:"7ee57568",2134:"7c0f3995",2146:"9a7cb864",2199:"74d29abd",2346:"09c205a8",2474:"4ebbae74",2490:"9c66aea4",2666:"e1dac9d5",2690:"2831f93f",2695:"39b4104b",2872:"4fdb0ed3",3042:"33dec790",3065:"ec25bd96",3085:"1f391b9e",3150:"101322bc",3220:"346ed820",3435:"788de0d5",3484:"6d236fd9",3651:"e797042a",3960:"7c8f1321",4151:"56bb67e4",4195:"c4f5d8e4",4314:"ecb8c869",4612:"3e0af071",5106:"2e760101",5645:"dbf1334c",5878:"33e000a8",6221:"573dc500",6703:"9a2cced2",6704:"1c994a8c",6743:"e262bf96",7125:"953b55b6",7408:"6f553965",7414:"393be207",7866:"ac335da5",7918:"17896441",7953:"5ef5ccac",8011:"ac4ce719",8196:"46b61f97",8767:"1e5a6619",9181:"7ca64cac",9251:"55ccdc72",9252:"e8fb6bd3",9514:"1be78505",9601:"01027624",9671:"0e384e19",9817:"14eb3368"}[e]||e)+"."+{53:"4d8e695e",691:"6f6de5c2",727:"d95ba4b8",911:"f3450080",1134:"1b7da0d4",1809:"a2fe4dc5",2134:"22b58048",2146:"74db14f0",2199:"127c8c08",2346:"abb2bd3e",2474:"2ccc7fe4",2490:"ff731f47",2666:"eb19981f",2690:"600e1c61",2695:"8532465d",2872:"c0df55a5",3042:"1d090c8a",3065:"f1d2f81e",3085:"cbdcce54",3150:"b5c5642f",3220:"7bec5207",3435:"6bf457bb",3484:"3ec76d0b",3651:"2f1277d9",3960:"f666835b",4151:"152dde9b",4195:"d948c370",4314:"acdc9c89",4612:"376c93ca",4972:"9b22aa21",5106:"d07c4b12",5469:"27feb786",5645:"1536330d",5878:"24789020",6221:"e3c567c5",6703:"7ca34b95",6704:"a6348028",6743:"8b3bc965",7125:"bf13d85c",7408:"737c50e0",7414:"f379ed57",7866:"06ce81cf",7918:"46ff5a09",7953:"41044fdd",8011:"95c0b7a9",8196:"6e76df09",8767:"865a35b6",9181:"8422319f",9251:"fa5d934e",9252:"6fc7793c",9514:"46ed04c5",9601:"5cf3ba43",9671:"5e75f8f1",9817:"824e779e"}[e]+".js",d.miniCssF=e=>{},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),t={},r="testpress-docs:",d.l=(e,a,c,f)=>{if(t[e])t[e].push(a);else{var b,o;if(void 0!==c)for(var n=document.getElementsByTagName("script"),i=0;i{b.onerror=b.onload=null,clearTimeout(l);var r=t[e];if(delete t[e],b.parentNode&&b.parentNode.removeChild(b),r&&r.forEach((e=>e(c))),a)return a(c)},l=setTimeout(u.bind(null,void 0,{type:"timeout",target:b}),12e4);b.onerror=u.bind(null,b.onerror),b.onload=u.bind(null,b.onload),o&&document.head.appendChild(b)}},d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.p="/",d.gca=function(e){return e={17896441:"7918","935f2afb":"53","85c7fbe8":"691","40bac974":"727","42363dad":"911","6bc9270a":"1134","7ee57568":"1809","7c0f3995":"2134","9a7cb864":"2146","74d29abd":"2199","09c205a8":"2346","4ebbae74":"2474","9c66aea4":"2490",e1dac9d5:"2666","2831f93f":"2690","39b4104b":"2695","4fdb0ed3":"2872","33dec790":"3042",ec25bd96:"3065","1f391b9e":"3085","101322bc":"3150","346ed820":"3220","788de0d5":"3435","6d236fd9":"3484",e797042a:"3651","7c8f1321":"3960","56bb67e4":"4151",c4f5d8e4:"4195",ecb8c869:"4314","3e0af071":"4612","2e760101":"5106",dbf1334c:"5645","33e000a8":"5878","573dc500":"6221","9a2cced2":"6703","1c994a8c":"6704",e262bf96:"6743","953b55b6":"7125","6f553965":"7408","393be207":"7414",ac335da5:"7866","5ef5ccac":"7953",ac4ce719:"8011","46b61f97":"8196","1e5a6619":"8767","7ca64cac":"9181","55ccdc72":"9251",e8fb6bd3:"9252","1be78505":"9514","01027624":"9601","0e384e19":"9671","14eb3368":"9817"}[e]||e,d.p+d.u(e)},(()=>{var e={1303:0,532:0};d.f.j=(a,c)=>{var t=d.o(e,a)?e[a]:void 0;if(0!==t)if(t)c.push(t[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var r=new Promise(((c,r)=>t=e[a]=[c,r]));c.push(t[2]=r);var f=d.p+d.u(a),b=new Error;d.l(f,(c=>{if(d.o(e,a)&&(0!==(t=e[a])&&(e[a]=void 0),t)){var r=c&&("load"===c.type?"missing":c.type),f=c&&c.target&&c.target.src;b.message="Loading chunk "+a+" failed.\n("+r+": "+f+")",b.name="ChunkLoadError",b.type=r,b.request=f,t[1](b)}}),"chunk-"+a,a)}},d.O.j=a=>0===e[a];var a=(a,c)=>{var t,r,f=c[0],b=c[1],o=c[2],n=0;if(f.some((a=>0!==e[a]))){for(t in b)d.o(b,t)&&(d.m[t]=b[t]);if(o)var i=o(d)}for(a&&a(c);n{"use strict";var e,a,c,t,r,f={},b={};function d(e){var a=b[e];if(void 0!==a)return a.exports;var c=b[e]={exports:{}};return f[e].call(c.exports,c,c.exports,d),c.exports}d.m=f,e=[],d.O=(a,c,t,r)=>{if(!c){var f=1/0;for(i=0;i=r)&&Object.keys(d.O).every((e=>d.O[e](c[o])))?c.splice(o--,1):(b=!1,r0&&e[i-1][2]>r;i--)e[i]=e[i-1];e[i]=[c,t,r]},d.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return d.d(a,{a:a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var r=Object.create(null);d.r(r);var f={};a=a||[null,c({}),c([]),c(c)];for(var b=2&t&&e;"object"==typeof b&&!~a.indexOf(b);b=c(b))Object.getOwnPropertyNames(b).forEach((a=>f[a]=()=>e[a]));return f.default=()=>e,d.d(r,f),r},d.d=(e,a)=>{for(var c in a)d.o(a,c)&&!d.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce(((a,c)=>(d.f[c](e,a),a)),[])),d.u=e=>"assets/js/"+({53:"935f2afb",691:"85c7fbe8",727:"40bac974",911:"42363dad",1134:"6bc9270a",1809:"7ee57568",2134:"7c0f3995",2146:"9a7cb864",2199:"74d29abd",2346:"09c205a8",2474:"4ebbae74",2490:"9c66aea4",2666:"e1dac9d5",2690:"2831f93f",2695:"39b4104b",2872:"4fdb0ed3",3042:"33dec790",3065:"ec25bd96",3085:"1f391b9e",3150:"101322bc",3220:"346ed820",3435:"788de0d5",3484:"6d236fd9",3651:"e797042a",3960:"7c8f1321",4151:"56bb67e4",4195:"c4f5d8e4",4314:"ecb8c869",4612:"3e0af071",5106:"2e760101",5645:"dbf1334c",5878:"33e000a8",6221:"573dc500",6703:"9a2cced2",6704:"1c994a8c",6743:"e262bf96",7125:"953b55b6",7408:"6f553965",7414:"393be207",7866:"ac335da5",7918:"17896441",7953:"5ef5ccac",8011:"ac4ce719",8196:"46b61f97",8767:"1e5a6619",9181:"7ca64cac",9251:"55ccdc72",9252:"e8fb6bd3",9514:"1be78505",9601:"01027624",9671:"0e384e19",9817:"14eb3368"}[e]||e)+"."+{53:"4d8e695e",691:"6f6de5c2",727:"d95ba4b8",911:"f3450080",1134:"1b7da0d4",1809:"a2fe4dc5",2134:"22b58048",2146:"74db14f0",2199:"127c8c08",2346:"abb2bd3e",2474:"2ccc7fe4",2490:"ff731f47",2666:"eb19981f",2690:"600e1c61",2695:"8532465d",2872:"c0df55a5",3042:"1d090c8a",3065:"f1d2f81e",3085:"cbdcce54",3150:"b5c5642f",3220:"7bec5207",3435:"6bf457bb",3484:"3ec76d0b",3651:"2f1277d9",3960:"f666835b",4151:"152dde9b",4195:"d948c370",4314:"acdc9c89",4612:"376c93ca",4972:"9b22aa21",5106:"d07c4b12",5469:"27feb786",5645:"1536330d",5878:"24789020",6221:"e3c567c5",6703:"7ca34b95",6704:"a6348028",6743:"8b3bc965",7125:"bf13d85c",7408:"737c50e0",7414:"f379ed57",7866:"06ce81cf",7918:"46ff5a09",7953:"41044fdd",8011:"95c0b7a9",8196:"6e76df09",8767:"865a35b6",9181:"8422319f",9251:"ad9c4214",9252:"6fc7793c",9514:"46ed04c5",9601:"5cf3ba43",9671:"5e75f8f1",9817:"824e779e"}[e]+".js",d.miniCssF=e=>{},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),t={},r="testpress-docs:",d.l=(e,a,c,f)=>{if(t[e])t[e].push(a);else{var b,o;if(void 0!==c)for(var n=document.getElementsByTagName("script"),i=0;i{b.onerror=b.onload=null,clearTimeout(l);var r=t[e];if(delete t[e],b.parentNode&&b.parentNode.removeChild(b),r&&r.forEach((e=>e(c))),a)return a(c)},l=setTimeout(u.bind(null,void 0,{type:"timeout",target:b}),12e4);b.onerror=u.bind(null,b.onerror),b.onload=u.bind(null,b.onload),o&&document.head.appendChild(b)}},d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.p="/",d.gca=function(e){return e={17896441:"7918","935f2afb":"53","85c7fbe8":"691","40bac974":"727","42363dad":"911","6bc9270a":"1134","7ee57568":"1809","7c0f3995":"2134","9a7cb864":"2146","74d29abd":"2199","09c205a8":"2346","4ebbae74":"2474","9c66aea4":"2490",e1dac9d5:"2666","2831f93f":"2690","39b4104b":"2695","4fdb0ed3":"2872","33dec790":"3042",ec25bd96:"3065","1f391b9e":"3085","101322bc":"3150","346ed820":"3220","788de0d5":"3435","6d236fd9":"3484",e797042a:"3651","7c8f1321":"3960","56bb67e4":"4151",c4f5d8e4:"4195",ecb8c869:"4314","3e0af071":"4612","2e760101":"5106",dbf1334c:"5645","33e000a8":"5878","573dc500":"6221","9a2cced2":"6703","1c994a8c":"6704",e262bf96:"6743","953b55b6":"7125","6f553965":"7408","393be207":"7414",ac335da5:"7866","5ef5ccac":"7953",ac4ce719:"8011","46b61f97":"8196","1e5a6619":"8767","7ca64cac":"9181","55ccdc72":"9251",e8fb6bd3:"9252","1be78505":"9514","01027624":"9601","0e384e19":"9671","14eb3368":"9817"}[e]||e,d.p+d.u(e)},(()=>{var e={1303:0,532:0};d.f.j=(a,c)=>{var t=d.o(e,a)?e[a]:void 0;if(0!==t)if(t)c.push(t[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var r=new Promise(((c,r)=>t=e[a]=[c,r]));c.push(t[2]=r);var f=d.p+d.u(a),b=new Error;d.l(f,(c=>{if(d.o(e,a)&&(0!==(t=e[a])&&(e[a]=void 0),t)){var r=c&&("load"===c.type?"missing":c.type),f=c&&c.target&&c.target.src;b.message="Loading chunk "+a+" failed.\n("+r+": "+f+")",b.name="ChunkLoadError",b.type=r,b.request=f,t[1](b)}}),"chunk-"+a,a)}},d.O.j=a=>0===e[a];var a=(a,c)=>{var t,r,f=c[0],b=c[1],o=c[2],n=0;if(f.some((a=>0!==e[a]))){for(t in b)d.o(b,t)&&(d.m[t]=b[t]);if(o)var i=o(d)}for(a&&a(c);n Admin APIs | Testpress docs - +

Admin APIs

- + \ No newline at end of file diff --git a/docs/category/android-native-sdk/index.html b/docs/category/android-native-sdk/index.html index c4cc138..56511fd 100644 --- a/docs/category/android-native-sdk/index.html +++ b/docs/category/android-native-sdk/index.html @@ -4,13 +4,13 @@ Android Native SDK | Testpress docs - + - + \ No newline at end of file diff --git a/docs/category/flutter-player-sdk/index.html b/docs/category/flutter-player-sdk/index.html index 1d35e75..3211cf1 100644 --- a/docs/category/flutter-player-sdk/index.html +++ b/docs/category/flutter-player-sdk/index.html @@ -4,13 +4,13 @@ Flutter Player SDK | Testpress docs - + - + \ No newline at end of file diff --git a/docs/category/ios-native-sdk/index.html b/docs/category/ios-native-sdk/index.html index b723bfe..747108e 100644 --- a/docs/category/ios-native-sdk/index.html +++ b/docs/category/ios-native-sdk/index.html @@ -4,13 +4,13 @@ iOS Native SDK | Testpress docs - + - + \ No newline at end of file diff --git a/docs/category/javascript-sdk/index.html b/docs/category/javascript-sdk/index.html index 092d06a..e5f459d 100644 --- a/docs/category/javascript-sdk/index.html +++ b/docs/category/javascript-sdk/index.html @@ -4,13 +4,13 @@ Javascript SDK | Testpress docs - + - + \ No newline at end of file diff --git a/docs/category/player-sdks/index.html b/docs/category/player-sdks/index.html index 7fe8798..b02cd6c 100644 --- a/docs/category/player-sdks/index.html +++ b/docs/category/player-sdks/index.html @@ -4,13 +4,13 @@ Player SDKs | Testpress docs - + - + \ No newline at end of file diff --git a/docs/category/plugins/index.html b/docs/category/plugins/index.html index becce7a..8f96278 100644 --- a/docs/category/plugins/index.html +++ b/docs/category/plugins/index.html @@ -4,13 +4,13 @@ Plugins | Testpress docs - + - + \ No newline at end of file diff --git a/docs/category/server-apis/index.html b/docs/category/server-apis/index.html index 56e3d67..7d736e6 100644 --- a/docs/category/server-apis/index.html +++ b/docs/category/server-apis/index.html @@ -4,13 +4,13 @@ Server APIs | Testpress docs - + - + \ No newline at end of file diff --git a/docs/category/students-apis/index.html b/docs/category/students-apis/index.html index 1589e10..8edc94d 100644 --- a/docs/category/students-apis/index.html +++ b/docs/category/students-apis/index.html @@ -8,7 +8,7 @@ Admin APIs require authorization token with admin privileges. You check the following link to generate authorization token. You need to provide admin username and password to generate token with admin privileges."> - + @@ -16,7 +16,7 @@
- + \ No newline at end of file diff --git a/docs/intro/index.html b/docs/intro/index.html index 2eb7a77..64db86e 100644 --- a/docs/intro/index.html +++ b/docs/intro/index.html @@ -4,13 +4,13 @@ Authentication | Testpress docs - +

Authentication

You need to authentication token to access the private resources and to generate access token for playback via Testpress API

Generate authentication token

Make Post request to the below link with the credentials to generate an authentication token.

POST http://demo.testpress.in/api/v2.5/auth-token/

NameTypeDescription
usernamestringUsername of the user
passwordstringPassword of the user

Sample code

import requests

url = "https://demo.testpress.in/api/v2.5/auth-token/"

payload = "{\n \"username\": \"testpress\",\n \"password\": \"demo\"\n}"
headers = {
'content-type': "application/json",
'cache-control': "no-cache",
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
caution

Replace demo with your institute subdomain hereafter everywhere.

Response

The response will return an token which should be prefixed with JWT and included in all API requests to the server in a header that looks like the following:

Authorization: JWT auth-token-string
- + \ No newline at end of file diff --git a/docs/server-api/Integration/create attempt by HMAC/index.html b/docs/server-api/Integration/create attempt by HMAC/index.html index bd691ff..001db71 100644 --- a/docs/server-api/Integration/create attempt by HMAC/index.html +++ b/docs/server-api/Integration/create attempt by HMAC/index.html @@ -4,13 +4,13 @@ create attempt by HMAC | Testpress docs - +

create attempt by HMAC

Create An Attempt By HMAC

  • Allows a user to take an exam in a seamless manner from your own website.
  • The flow will be similar to that of making a purchase using a payment gateway.
  • Users would be redirected to testpress page where users can attempt an exam.
  • Once user completes the exam, Testpress would redirect to the success url (surl) given in POST Parameter

HTTP Request

POST <exam_url>

exam_url can be taken from Testpress Admin dashboard. Once an exam is created, URL can be copied from Exam's List Page

Fields

NameTypeDescription
emailstringEmail Address of the user
first_namestringFirst name of the user
institute_attempt_idstringUnique reference string generated at your end (Institute's end). This can be used to track a particular attempt.
keystringPublic institute key provided by Testpress to identify the Institute
timestringTime since epoch used during the HMAC creation
hmacstringHMAC generated using the below algorithm
surlurlPercentage encoded URL to be called by Testpress after successful completion of the exam

How To Create HMAC

HMAC (Hash-based message authentication code) is used to avoid tampering during the request flow. We use a time based HMAC algorithm to limit the lifetime of the HMAC.

The HMAC is calculated using the following algorithm:

  • Get the values of 'email', 'first_name', 'institute_attempt_id', 'key', 'time'
  • Percentage encode the values
  • time will be time since epoch in seconds
  • Create a string by appending the above percentage encoded values using | pipe character. Maintain the same order while appending (uses alphabetical order of the keys)
  • Calculate the HMAC using HMAC-SHA256 with the secret
  • Secret can be received from the admin dashboard

Secret can be received from the admin dashboard

info

Usage of time

The epoch time limits the validity of the HMAC. We have a 30 minute delta to ensure the validity of the HMAC. For ex: if the HMAC was generated at 10.30 AM, it will be valid only for the next 30 minutes and can be used to start an attempt only till 11.00 AM.

Response Parameters For Attempt Creation

Below are the response parameters posted by Testpress to Institute when an exam is completed / cancelled

NameTypeDescription
emailstringEmail Address of the user
first_namestringFirst name of the user
attempt_idstringUnique Testpress Id for the Attempt. This id will be used to review the attempt
institute_attempt_idstringUnique reference string generated at your end (Institute's end). This can be used to track a particular attempt.
total_countstringTotal number of questions in the Exam
correct_countstringTotal number of correct attempts by the user
incorrect_countstringTotal number of incorrect attempts
unanswered_countstringTotal number of unattemptted questions
scorestringScore gained by the student
max_scorestringMaximum grade for the test
rankstringStudent's rank. Rank will be set only if the ranks are enabled for the exam
max_rankstringTotal number of students attemptted the exam
percentagestringScore percentage
statusstringcompleted / cancelled / pending
hmacstringHMAC generated using the below algorithm
- + \ No newline at end of file diff --git a/docs/server-api/Integration/exam-webhook/index.html b/docs/server-api/Integration/exam-webhook/index.html index 3af3caf..c9003c3 100644 --- a/docs/server-api/Integration/exam-webhook/index.html +++ b/docs/server-api/Integration/exam-webhook/index.html @@ -4,7 +4,7 @@ Exam webhook | Testpress docs - + @@ -12,7 +12,7 @@

Exam webhook

How To Enable Exam Webhook

  • In the Institute settings, locate the Exam webhook URL field and add the desired URL for the webhook.
  • To test the webhook, use a URL generated from a webhook site like Webhook site
  • The webhook will automatically post data to the provided URL when Exam attempts are started or completed.

Data Posted To The Exam Webhook URL

Below are the response parameters posted by Testpress to Institute when an attempt is started and completed.

NameTypeDescription
emailstringEmail Address of the user
usernamestringUsername of the user
attempt_idintegerUnique Testpress Id for the Attempt. This id will be used to review the attempt
examkey/value pairThis key/value pair will contain exam details like "id", "title", "start_date", "end_date", "duration".
total_countintegerTotal number of questions in the Exam
correct_answers_countstringTotal number of correct answers in the attempt
incorrect_answers_countintegerTotal number of incorrect answers in the attempt
unanswered_answers_countintegerTotal number of unattemptted questions in the attempt
scoreintegerTotal score obtained by the user for the attempt
percentageintegerscore percentage
keystringPublic institute key provided by Testpress to identify the Institute
hashstringHash generated using above algorithm.
subject_statskey/value pairThis key/value pair will contain subject wise details
difficulty_level_statskey/value pairThis key/value pair will contain difficulty wise details

In the above data hash value is used to identify that the data is indeed posted from testpress.

Start Exam Webhook Response

{
"username": "test_user",
"accuracy": 0,
"hash": "8291fc65f59336716b072ae3936aeaeabbe56685e812144d87722430e80ae6c10feaf82c83dfb75ca4696e2b1f60eb72a68b376e15b3dfb5a2717d3a51973c88",
"exam": {
"id": 27,
"title": "File type exam",
"duration": null,
"start_date": "2023-03-15T12:04:32+05:30",
"end_date": null
},
"subject_stats": [],
"email": "karthiktest51@gmail.com",
"partial_correct_answers_count": null,
"attempt_id": 130,
"attempt_state": "started",
"incorrect_answers_count": 0,
"difficulty_level_stats": {},
"completed_on": null,
"unanswered_answers_count": 0,
"key": "YDRAXrgV3STf7EH5",
"attempt_start_time": "2023-03-31T10:55:54.968829Z",
"user_id": 2,
"percentage": "0.00",
"score": "0.00",
"speed": 0,
"institute_attempt_id": null,
"correct_answers_count": 0
}

End Exam Webhook Response

{
"username": "student",
"accuracy": 0,
"hash": "dc206631d1fb9a73dd1b8119b63bcfd6f2700bbd20dc6bbb7999e11f182697104cc72cb323b153ff42565481ff3d777087de7c88956c637897b43272d5b9dc9f",
"exam": {
"id": 27,
"title": "File type exam",
"duration": null,
"start_date": "2023-03-15T12:04:32+05:30",
"end_date": null
},
"subject_stats": [
{
"subject_name": "Quantitative",
"parent_subject_id": null,
"correct_answers_count": 0,
"incorrect_answers_count": 0,
"partial_correct_answers_count": 0,
"unanswered_count": 1,
"answered_count": 0,
"total_count": 1,
"score": "0.00"
}
],
"email": "karthiktest51@gmail.com",
"partial_correct_answers_count": 0,
"attempt_id": 130,
"attempt_state": "completed",
"incorrect_answers_count": 0,
"difficulty_level_stats": {
"uncategorized": {
"correct_answers_count": 0,
"incorrect_answers_count": 0,
"partial_correct_answers_count": 0,
"unanswered_count": 1,
"total_count": 1
}
},
"completed_on": "2023-03-31T16:27:41.151586+05:30",
"unanswered_answers_count": 1,
"key": "YDRAXrgV3STf7EH5",
"attempt_start_time": "2023-03-31T10:55:54.968829Z",
"user_id": 2,
"percentage": "0.00",
"score": "0.00",
"speed": 0,
"institute_attempt_id": null,
"correct_answers_count": 0
}

How To Generate The Hash And Verify The Authenticity Of The Data

HMAC (Hash-based message authentication code) is used to avoid tampering during the request flow. The hash is calculated using the following algorithm:

  • Get the values of 'public_key', 'attempt_id', 'correct_answers_count', 'private_key', 'incorrct_answers_count', 'unanswered_count', 'percentage', 'score', 'user_id'
  • Create a string by appending the above percentage encoded values using | pipe character. Maintain the same order while appending
  • Calculate the HMAC using HMAC-SHA512 with the private key.
  • Private key can be taken from the admin dashboard. hmac.new(secret, message, hashlib.sha512).hexdigest()
- + \ No newline at end of file diff --git a/docs/server-api/Integration/review attempt by HMAC/index.html b/docs/server-api/Integration/review attempt by HMAC/index.html index 524a0a2..be6258c 100644 --- a/docs/server-api/Integration/review attempt by HMAC/index.html +++ b/docs/server-api/Integration/review attempt by HMAC/index.html @@ -4,13 +4,13 @@ review attempt by HMAC | Testpress docs - +

review attempt by HMAC

Review Exam Attempt By HMAC

  • Allows a user to review the exam he has attempted.
  • User would be redirected to testpress page where users can review the exam.
  • User can check the subject wise analytics / time analytics, correct and incorrect questions.
  • Comments/doubts can be posted by user to questions and can also see comments posted by peer students.

HTTP Request

GET /exams/attempts/?id=<id>&hmac=<hmac>&time=<time>

How to create HMAC

HMAC (Hash-based message authentication code) is used to avoid tampering during the request flow. We use a time based HMAC algorithm to limit the lifetime of the HMAC.

The HMAC is calculated using the following algorithm:

  • Get the values of 'email', 'first_name', 'institute_attempt_id', 'key', 'time'
  • Percentage encode the values
  • time will be time since epoch in seconds
  • Create a string by appending the above percentage encoded values using | pipe character. Maintain the same order while appending (uses alphabetical order of the keys)
  • Calculate the HMAC using HMAC-SHA256 with the secret
  • Secret can be received from the admin dashboard

message = id|institute_attempt_id|key|time hmac.new(secret, message, hashlib.sha256).hexdigest()

NameTypeDescription
idstringAttempt ID provided by testpress
institute_attempt_idstring Institute's attempy Id
keystringPublic institute key provided by Testpress to identify the Institute
timestringTime since epoch used during the HMAC creation
hmacstringHMAC generated using the below algorithm
- + \ No newline at end of file diff --git a/docs/server-api/Integration/single-sign-on/index.html b/docs/server-api/Integration/single-sign-on/index.html index 11e91f7..a12f978 100644 --- a/docs/server-api/Integration/single-sign-on/index.html +++ b/docs/server-api/Integration/single-sign-on/index.html @@ -4,13 +4,13 @@ Single Sign On (SSO) | Testpress docs - +

Single Sign On (SSO)

This endpoint is used to authenticate the user using your own existing authentication system.

HTTP REQUEST

GET /sso_login/?sig=<hmac-signature>&sso=<payload>

To generate SSO URL, you need to generate

  1. Payload
  2. HMAC signature

PAYLOAD

The payload is a special string which is generated as follows

  • Concatenate the parameters in the following table with &
  • Encode the concatenated string with base64 encoding.
ParameterTypeDescription
email/usernamestringEmail Address or username of the user respectively
timestringTime since epoch

Example with email

email=demo@testpress.in&time=1554879681

Example with username

username=demo@testpress.in&time=1554879681
import base64, time

epoch_time = int(time.time())
query_string = "email=demo@testpress.in&time={}".format(epoch_time)
payload = base64.b64encode(query_string)

print(payload)

The above snippet returns payload as shown below

ZW1haWw9ZGVtb0B0ZXN0cHJlc3MuaW4mdGltZT0xNTU0ODc5Njgx

HMAC Signature

  • HMAC (Hash-based Message Authentication Code) is used to ensure the security and integrity of requests during data transfer.
  • To generate an HMAC signature for Testpress exam software, you'll need a payload (generated in a previous step) and a secret key obtained from the Testpress team.
import hashlib, hmac, time

epoch_time = int(time.time())
query_string = "email=demo@testpress.in&time={}".format(epoch_time)
payload = base64.b64encode(query_string)

secret_key = "abcxyzqwerty"
hmac_signature = hmac.new(secret_key, payload, hashlib.sha256).hexdigest()

print(hmac_signature)

The above snippet returns HMAC signature as shown below

aa747c502a898200f9e4fa21bac68136f886a0e27aec70ba06daf2e2a5cb5597

SSO URL

The SSO URL format is as shown below

https://demo.testpress.in/sso_login/?sig=<hmac-signature>&sso=<payload>

In the above URL replace the {hmac-signature} and {payload} with your hmac signature and payload values generated using the above steps.

E.g. https://demo.testpress.in/sso_login/?sig=aa747c502a898200f9e4fa21bac68136f886a0e27aec70ba06daf2e2a5cb5597&sso=ZW1haWw9ZGVtb0B0ZXN0cHJlc3MuaW4mdGltZT0xNTU0ODc5Njgx
info

The epoch time limits the validity of the HMAC. We have a 30 minute delta to ensure the validity of the HMAC. For e.g. if the HMAC was generated at 10.30 AM, it will be valid only for the next 30 minutes and expires after 11.00 AM.

Redirect user to a particular exam

Redirect the user to a particular by passing the exam start URL as a redirect path to the above SSO login link, like below

https://demo.testpress.in/sso_login/?sig=<hmac-signature>&sso=<payload>&next=/exams/run/<exam-slug>/start/
- + \ No newline at end of file diff --git a/docs/server-api/admin-apis/attempts/index.html b/docs/server-api/admin-apis/attempts/index.html index 4f022cc..15c9798 100644 --- a/docs/server-api/admin-apis/attempts/index.html +++ b/docs/server-api/admin-apis/attempts/index.html @@ -4,7 +4,7 @@ Attempts | Testpress docs - + @@ -38,8 +38,8 @@ exam_url: "https://sandbox.testpress.in/api/v2.5/admin/exams/133/", user_url: "https://sandbox.testpress.in/api/v2.5/admin/users/133/" }] -}

Examples

  • /api/v2.5/admin/attempts/?exams=5 - This will display attempt of exam with id 5
  • /api/v2.5/admin/attempts/?users=1&exams=2 - This will display attempts of exam whose id is 2 for the user id 1
  • /api/v2.5/admin/attempts/?date_0=2020-01-11&date_1=2021-02-02&ordering=date - This will display attempts that are attempted between 11/1/2020 and 2/2/2021. Oldest attempted exams will be displayed first

Get A Single Attempt

This endpoint retrieves a single attempt.

HTTP Request

GET /api/v2.5/admin/attempts/<id>/

URL Parameters

ParameterDescription
idThe unique id of the attempt to retrieve
curl --request GET \
--url http://demo.testpress.in/api/v2.5/admin/attempts/125894/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"id": 1,
"date": "2023-01-23T11:35:37.930389+05:30",
"exam_id": 2,
"user_id": 2,
"email": "hariharan@testpress.in",
"name": null,
"phone": null,
"correct_answers_count": 0,
"incorrect_answers_count": 1,
"unanswered_count": 79,
"score": "0.00",
"percentage": 0,
"percentile": 100.0,
"time_taken": "2:47:53.076906",
"remaining_time": "0:00:00",
"result": "Fail",
"state": "Completed",
"last_started_time": "2023-04-02T15:27:46.453786+05:30",
"last_answer_updated_time": "2023-04-02T15:27:59.639308+05:30",
"speed": 0,
"exam_url": "http://demo.tespress.in/api/v2.5/admin/exams/2/",
"user_url": "http://demo.tespress.in/api/v2.5/admin/users/2/",
"username": "admin",
"sections": [
{
"id": 1,
"order": 0,
"section_id": 2,
"time_taken": "0:00:00",
"correct_answers_count": 0,
"incorrect_answers_count": 0,
"unanswered_count": 20,
"score": "0.00"
},
{
"id": 2,
"order": 1,
"section_id": 3,
"time_taken": "0:00:00",
"correct_answers_count": 0,
"incorrect_answers_count": 1,
"unanswered_count": 20,
"score": "0.00"
},
{
"id": 3,
"order": 2,
"section_id": 4,
"time_taken": "0:00:00",
"correct_answers_count": 0,
"incorrect_answers_count": 0,
"unanswered_count": 20,
"score": "0.00"
},
{
"id": 4,
"order": 3,
"section_id": 5,
"time_taken": "0:00:00",
"correct_answers_count": 0,
"incorrect_answers_count": 0,
"unanswered_count": 19,
"score": "0.00"
}
],
"subject_stats": [
{
"subject_id": 1,
"subject_name": "Geography",
"total_count": 64,
"correct_answers_count": 0,
"unanswered_count": 63,
"incorrect_answers_count": 1,
"parent_subject_id": null,
"is_leaf": true,
"score": "0.00",
"partial_correct_answers_count": 0
},
{
"subject_id": 2,
"subject_name": "Current affairs",
"total_count": 12,
"correct_answers_count": 0,
"unanswered_count": 12,
"incorrect_answers_count": 0,
"parent_subject_id": null,
"is_leaf": true,
"score": "0.00",
"partial_correct_answers_count": 0
},
{
"subject_id": null,
"subject_name": "History",
"total_count": 4,
"correct_answers_count": 0,
"unanswered_count": 4,
"incorrect_answers_count": 0,
"parent_subject_id": null,
"is_leaf": true,
"score": "0.00",
"partial_correct_answers_count": 0
}
],
"difficulty_level_stats": {
"easy": {
"correct_answers_count": 0,
"incorrect_answers_count": 1,
"partial_correct_answers_count": 0,
"unanswered_count": 69,
"total_count": 70
},
"medium": {
"correct_answers_count": 0,
"incorrect_answers_count": 5,
"partial_correct_answers_count": 0,
"unanswered_count": 5,
"total_count": 10
}
},
"institute_attempt_id": 100101
}

Get Chapter Content Attempts

This endpoint retrieves the chapter content attempts list for all users.

HTTP Request

GET /api/v3/admin/chapter-content-attempts/

Query Parameters

ParameterTypeDescription
user_idsintUnique user ID
chapter_idsintUnique chapter ID
course_idsintUnique course ID
chapter_content_idsintUnique chapter content ID
exam_idintUnique exam ID
content_typeintType of content
stateintStatus of the attempt
completed_datestringdate in the format yyyy-mm-dd
completed_beforestringdate in the format yyyy-mm-dd
completed_afterstringdate in the format yyyy-mm-dd
curl --request GET \
--url http://demo.testpress.in/api/v3/admin/chapter-content-attempts/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 1,
"next": null,
"previous": null,
"per_page": 250,
"results": {
"content_attempts": [
{
"id": 764,
"user_id": 9,
"course_id": 8,
"chapter_id": 33,
"chapter_content_id": 127,
"content_type": "video",
"state": "Started",
"remaining_time": null,
"assessment_id": null,
"user_video_conference_id": null,
"user_video_id": 55,
"user_live_stream_id": null,
"user_content_id": null,
"user_attachment_id": null,
"created": "2024-07-15T18:49:52.059055+05:30",
"completed_on": null
},
],
"user_videos": [
{
"id": 55,
"video_id": 18,
"created": "2024-07-15T18:38:42.853855+05:30",
"watched_percentage": 0,
"remaining_duration": null,
"state": "Started",
"is_live_class_recording": false
}

]
}
}

Get Video Conference Attempts

This endpoint retrieves the details of attempts for a video conference.

HTTP Request

GET /api/v3/admin/attempts/<id>/video-conference/

URL Parameters

ParameterDescription
idThe unique id of the video conference

Example

/api/v3/admin/attempts/12/video-conference/

This endpoint will retrieve the details of attempts for the video conference with ID 12.

Response Fields

NameTypeDescription
namestringName of the user
emailstringEmail of the user
joined_timestringTime of joining the video conference in ISO 8601 format
leave_timestringTime of leaving the video conference in ISO 8601 format
durationintDuration of attendance in seconds
curl --request GET \
--url http://demo.testpress.in/api/v3/admin/attempts/12/video-conference/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"name": "deva",
"email": "deva@testpress.in",
"join_time": "2024-06-10T16:20:26+05:30",
"leave_time": "2024-06-10T16:22:26+05:30",
"duration": 120
},
{
"name": "alwin",
"email": "alwin@testpress.in",
"join_time": "2024-06-10T16:19:55+05:30",
"leave_time": "2024-06-10T16:22:27+05:30",
"duration": 152
}
]
}
- +}

Examples

  • /api/v2.5/admin/attempts/?exams=5 - This will display attempt of exam with id 5
  • /api/v2.5/admin/attempts/?users=1&exams=2 - This will display attempts of exam whose id is 2 for the user id 1
  • /api/v2.5/admin/attempts/?date_0=2020-01-11&date_1=2021-02-02&ordering=date - This will display attempts that are attempted between 11/1/2020 and 2/2/2021. Oldest attempted exams will be displayed first

Get A Single Attempt

This endpoint retrieves a single attempt.

HTTP Request

GET /api/v2.5/admin/attempts/<id>/

URL Parameters

ParameterDescription
idThe unique id of the attempt to retrieve
curl --request GET \
--url http://demo.testpress.in/api/v2.5/admin/attempts/125894/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"id": 1,
"date": "2023-01-23T11:35:37.930389+05:30",
"exam_id": 2,
"user_id": 2,
"email": "hariharan@testpress.in",
"name": null,
"phone": null,
"correct_answers_count": 0,
"incorrect_answers_count": 1,
"unanswered_count": 79,
"score": "0.00",
"percentage": 0,
"percentile": 100.0,
"time_taken": "2:47:53.076906",
"remaining_time": "0:00:00",
"result": "Fail",
"state": "Completed",
"last_started_time": "2023-04-02T15:27:46.453786+05:30",
"last_answer_updated_time": "2023-04-02T15:27:59.639308+05:30",
"speed": 0,
"exam_url": "http://demo.tespress.in/api/v2.5/admin/exams/2/",
"user_url": "http://demo.tespress.in/api/v2.5/admin/users/2/",
"username": "admin",
"sections": [
{
"id": 1,
"order": 0,
"section_id": 2,
"time_taken": "0:00:00",
"correct_answers_count": 0,
"incorrect_answers_count": 0,
"unanswered_count": 20,
"score": "0.00"
},
{
"id": 2,
"order": 1,
"section_id": 3,
"time_taken": "0:00:00",
"correct_answers_count": 0,
"incorrect_answers_count": 1,
"unanswered_count": 20,
"score": "0.00"
},
{
"id": 3,
"order": 2,
"section_id": 4,
"time_taken": "0:00:00",
"correct_answers_count": 0,
"incorrect_answers_count": 0,
"unanswered_count": 20,
"score": "0.00"
},
{
"id": 4,
"order": 3,
"section_id": 5,
"time_taken": "0:00:00",
"correct_answers_count": 0,
"incorrect_answers_count": 0,
"unanswered_count": 19,
"score": "0.00"
}
],
"subject_stats": [
{
"subject_id": 1,
"subject_name": "Geography",
"total_count": 64,
"correct_answers_count": 0,
"unanswered_count": 63,
"incorrect_answers_count": 1,
"parent_subject_id": null,
"is_leaf": true,
"score": "0.00",
"partial_correct_answers_count": 0
},
{
"subject_id": 2,
"subject_name": "Current affairs",
"total_count": 12,
"correct_answers_count": 0,
"unanswered_count": 12,
"incorrect_answers_count": 0,
"parent_subject_id": null,
"is_leaf": true,
"score": "0.00",
"partial_correct_answers_count": 0
},
{
"subject_id": null,
"subject_name": "History",
"total_count": 4,
"correct_answers_count": 0,
"unanswered_count": 4,
"incorrect_answers_count": 0,
"parent_subject_id": null,
"is_leaf": true,
"score": "0.00",
"partial_correct_answers_count": 0
}
],
"difficulty_level_stats": {
"easy": {
"correct_answers_count": 0,
"incorrect_answers_count": 1,
"partial_correct_answers_count": 0,
"unanswered_count": 69,
"total_count": 70
},
"medium": {
"correct_answers_count": 0,
"incorrect_answers_count": 5,
"partial_correct_answers_count": 0,
"unanswered_count": 5,
"total_count": 10
}
},
"institute_attempt_id": 100101
}

Get Student Exam Responses

This endpoint retreives the student responses for a particular exam.

HTTP Request

GET /api/v3/admin/attempts/<id>/user_answers/

URL Parameters

ParameterDescription
idThe unique id of the attempt to retrieve the student responses.
curl --request GET \
--url http://demo.testpress.in/api/v3/admin/attempts/423/user_answers/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 1,
"next": null,
"previous": null,
"per_page": 250,
"results": {
"user_answers": [
{
"id": 476,
"exam_question_id": 39,
"selected_answers": [
6
],
"result": "Incorrect",
"duration": 5,
"review": false,
"guessed": null
},
],
"exam_questions": [
{

"id": 39,
"question_id": 2,
"section_id": 90,
"question_html": "<style type='text/css'>\n \n</style>\n<p>where is Paris ?</p>",
"type": "MCQ, Single Correct",
"marks": "1.00",
"negative_marks": "0.00",
"partial_marks": null,
"direction": null,
"answers": [
{
"id": 5,
"text_html": "<style type='text/css'>\n \n</style>\n<p>France</p>"
},
{
"id": 6,
"text_html": "<style type='text/css'>\n \n</style>\n<p>Italy</p>"
},
{
"id": 7,
"text_html": "<style type='text/css'>\n \n</style>\n<p>Belgium</p>"
},
{
"id": 8,
"text_html": "<style type='text/css'>\n \n</style>\n<p>Germany</p>"
}
],
"difficulty_level": null,
"order": 0,
"is_bonus": false,
"exam_id": 46
},

]
}
}


Get Chapter Content Attempts

This endpoint retrieves the chapter content attempts list for all users.

HTTP Request

GET /api/v3/admin/chapter-content-attempts/

Query Parameters

ParameterTypeDescription
user_idsintUnique user ID
chapter_idsintUnique chapter ID
course_idsintUnique course ID
chapter_content_idsintUnique chapter content ID
exam_idintUnique exam ID
content_typeintType of content
stateintStatus of the attempt
completed_datestringdate in the format yyyy-mm-dd
completed_beforestringdate in the format yyyy-mm-dd
completed_afterstringdate in the format yyyy-mm-dd
curl --request GET \
--url http://demo.testpress.in/api/v3/admin/chapter-content-attempts/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 1,
"next": null,
"previous": null,
"per_page": 250,
"results": {
"content_attempts": [
{
"id": 764,
"user_id": 9,
"course_id": 8,
"chapter_id": 33,
"chapter_content_id": 127,
"content_type": "video",
"state": "Started",
"remaining_time": null,
"assessment_id": null,
"user_video_conference_id": null,
"user_video_id": 55,
"user_live_stream_id": null,
"user_content_id": null,
"user_attachment_id": null,
"created": "2024-07-15T18:49:52.059055+05:30",
"completed_on": null
},
],
"user_videos": [
{
"id": 55,
"video_id": 18,
"created": "2024-07-15T18:38:42.853855+05:30",
"watched_percentage": 0,
"remaining_duration": null,
"state": "Started",
"is_live_class_recording": false
}

]
}
}

Get Video Conference Attempts

This endpoint retrieves the details of attempts for a video conference.

HTTP Request

GET /api/v3/admin/attempts/<id>/video-conference/

URL Parameters

ParameterDescription
idThe unique id of the video conference

Example

/api/v3/admin/attempts/12/video-conference/

This endpoint will retrieve the details of attempts for the video conference with ID 12.

Response Fields

NameTypeDescription
namestringName of the user
emailstringEmail of the user
joined_timestringTime of joining the video conference in ISO 8601 format
leave_timestringTime of leaving the video conference in ISO 8601 format
durationintDuration of attendance in seconds
curl --request GET \
--url http://demo.testpress.in/api/v3/admin/attempts/12/video-conference/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"name": "deva",
"email": "deva@testpress.in",
"join_time": "2024-06-10T16:20:26+05:30",
"leave_time": "2024-06-10T16:22:26+05:30",
"duration": 120
},
{
"name": "alwin",
"email": "alwin@testpress.in",
"join_time": "2024-06-10T16:19:55+05:30",
"leave_time": "2024-06-10T16:22:27+05:30",
"duration": 152
}
]
}
+ \ No newline at end of file diff --git a/docs/server-api/admin-apis/batches/index.html b/docs/server-api/admin-apis/batches/index.html index fcd1218..7d2156b 100644 --- a/docs/server-api/admin-apis/batches/index.html +++ b/docs/server-api/admin-apis/batches/index.html @@ -4,13 +4,13 @@ Batches | Testpress docs - +

Batches

info

Admin APIs require authorization token with admin privileges. You check the following link to generate an authorization token. You need to provide an admin username and password to generate token with admin privileges.

Authentication

Batches API lets you create and retrieve batches in your institute.

Get All Batches

This endpoint retrieves all the batches available in your institute

HTTP Request

GET /api/v2.5/admin/batches/

Query Parameters

ParameterTypeDescription
searchstringFilters by batch name.

Fields

NameTypeDescription
idintThe batch unique ID
namestringBatch's Name
urlstringURL to get details of the batch
is_localbooleanIs this a local batch, True or False
curl --request GET \
--url http://demo.testpress.in/api/v2.5/admin/batches/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MTgsInVzZXJfaWQiOjE4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAzMTEyNzl9.fDF03EIOEoXTyVUA3sN9-biUGhWrzO_NIZo1KYCUkbU' \
--header 'cache-control: no-cache'

Response

{
"count": 21,
"next": "http://demo.testpress.in/api/v2.5/admin/batches/?page=2",
"previous": null,
"per_page": 20,
"results": [
{
"id": 33,
"name": "TNPSC DEMO EXAM BATCH",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/33/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 32,
"name": "Orient Ias Test Batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/32/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 31,
"name": "Super Profs Test batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/31/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 30,
"name": "Sample new",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/30/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 29,
"name": "Test Batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/29/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 28,
"name": "9th Students Tambaram 2016",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/28/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 27,
"name": "8th Standard Tambaram 2016",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/27/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 26,
"name": "UPSC Evening Batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/26/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 25,
"name": "IBPS Online Batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/25/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 24,
"name": "NEET Morning Batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/24/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 23,
"name": "UPSC Morning Batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/23/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 22,
"name": "IBPS Morning Batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/22/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 21,
"name": "st std A",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/21/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 20,
"name": "OHC 2013",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/20/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 19,
"name": "POZITIVE ONLINE TEST SERIES",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/19/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 18,
"name": "Unique UPSC Batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/18/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 17,
"name": "ECE",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/17/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 16,
"name": "EEE",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/16/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 15,
"name": "DISHA BATCH 1",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/15/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
},
{
"id": 2,
"name": "Career Anna Test Batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/2/"
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
}
]
}

Get A Single Batch

This endpoint retrieves details of a single batch

HTTP Request

GET /api/v2.5/admin/batches/<id>

URL Parameters

ParameterDescription
idUnique Id of the batch to retriever
curl --request GET \
--url http://demo.testpress.in/api/v2.5/admin/batches/26/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MTgsInVzZXJfaWQiOjE4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAzMTEyNzl9.fDF03EIOEoXTyVUA3sN9-biUGhWrzO_NIZo1KYCUkbU' \
--header 'cache-control: no-cache'

Response

 {
"id": 26,
"name": "UPSC Evening Batch",
"url": "http://demo.testpress.in/api/v2.5/admin/batches/26/",
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
}

Create A Batch

This endpoint creates a new batch in your institute

HTTP Request

POST /api/v2.5/admin/batches/
NameTypeDescription
idintThe batch unique ID
namestringBatch's Name
urlstringURL to get details of the batch
is_localbooleanIs this a local batch, True or False
curl --request POST \
--url http://demo.testpress.in/api/v2.5/admin/batches/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MTgsInVzZXJfaWQiOjE4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAzMTEyNzl9.fDF03EIOEoXTyVUA3sN9-biUGhWrzO_NIZo1KYCUkbU' \
--header 'cache-control: no-cache' \
--data '{\n "name": "Online Test Batch"\n}'

Response

 {
"id": 28,
"name": "Online Test Batch",
"url": "http://demo.testbench.in:8000/api/v2.5/admin/batches/28/",
"created": "2021-12-01T12:17:22.293198Z",
"modified": "2021-12-01T12:17:22.296839Z",
"is_local": null
}

- + \ No newline at end of file diff --git a/docs/server-api/admin-apis/courses/index.html b/docs/server-api/admin-apis/courses/index.html index fa01f91..08a40f7 100644 --- a/docs/server-api/admin-apis/courses/index.html +++ b/docs/server-api/admin-apis/courses/index.html @@ -4,7 +4,7 @@ Courses | Testpress docs - + @@ -895,7 +895,7 @@ "tags": [] } }

- + \ No newline at end of file diff --git a/docs/server-api/admin-apis/exams/index.html b/docs/server-api/admin-apis/exams/index.html index 4f68779..6cfce5f 100644 --- a/docs/server-api/admin-apis/exams/index.html +++ b/docs/server-api/admin-apis/exams/index.html @@ -4,7 +4,7 @@ Exams | Testpress docs - + @@ -36,7 +36,7 @@ } ] }

Examples:

/api/v2.5/admin/exams/?start_date=2020-02-02&ordering=-start_date

The above URL will display exams that have start date greater than 2nd Feb 2020 and exams with recent start date will displayed first

/api/v2.5/admin/exams/?status=running&ordering=start_date

The above URL will display exams are running and exams with oldest start date will be displayed first

- + \ No newline at end of file diff --git a/docs/server-api/admin-apis/mentors/index.html b/docs/server-api/admin-apis/mentors/index.html index e4e6271..3e6005a 100644 --- a/docs/server-api/admin-apis/mentors/index.html +++ b/docs/server-api/admin-apis/mentors/index.html @@ -4,13 +4,13 @@ Mentors | Testpress docs - +

Mentors

Admin APIs require authorization token with admin privileges. You check the following link to generate authorization token. You need to provide admin username and password to generate token with admin privileges.

Authentication

Admin Mentors API gives you access to create/view mentors and add/remove students to mentors.

Create Mentor

This endpoint creates a mentor.

HTTP Request

POST /api/v2.5/admin/mentors/

Fields

NameTypeDescription
usernamestringUsername of the mentor
passwordstringpassword of the mentor
first_namestringFirst name of the mentor
last_namestringLast name of the mentor
emailstringEmail of the mentor
birth_datedatestringBirth date of mentor. Should be in DD/MM/YYYY format
gender_codestringGender of mentor. Can be "male", "female" or "trans"
address1stringAddress of mentor
address2stringAddress of mentor
citystringCity of mentor
zipstringPincode of mentor
state_codestringState of mentor in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of mentor
curl --request POST \
--url http://demo.testpress.in/api/v2.5/admin/mentors/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6InN0ZWVwaGFuc2VsdmFyYWpAdGVzdHByZXNzLmluIiwiZXhwIjoxNDc1MDYyMTkwfQ.iwVg_UM4HBB6qs21fe2b6FlNz_JjRfqcs2VTML4Te3k' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 9624f4b4-d495-aaaa-df27-b99f0cef13b4' \
--data '{\n "username": "Georgebobby", \n "password":"password",\n "first_name": "George", \n "last_name": "Bobby", \n "email": "george@hotmail.com", \n "birth_date": "03/07/1990", \n "gender_code": "male", \n "address1": "21 New Street", \n "address2": "Chrompet", \n "city": "Chennai", \n "zip": "641003", \n "state_code": "IN-TN", \n "phone": "9876543210"\n}'

Response

{
"id": 45,
"username": "Georgebobby",
"email": "george@hotmail.com",
"first_name": "George",
"last_name": "Bobby",
"display_name": "George Bobby",
"gender": "Male",
"state": "Tamil Nadu",
"created": "2016-09-28T19:06:18.177Z",
}


View Mentors

This endpoint allows you to view all the mentors.

HTTP Request

GET /api/v2.2/admin/mentors/

Response Fields

NameTypeDescription
idintThe mentor unique ID
usernamestringUsername of the mentor
first_namestringFirst name of the mentor
last_namestringLast name of the mentor
display_namestringDisplay name of the mentor
genderstringGender of the mentor
statestringState of the mentor
createddatetimefieldDate and time when mentor created
studentsarrayStudent details.
curl --request GET \
--url http://demo.testpress.in/api/v2.2/admin/mentors/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6InN0ZWVwaGFuc2VsdmFyYWpAdGVzdHByZXNzLmluIiwiZXhwIjoxNDc1MDYyMTkwfQ.iwVg_UM4HBB6qs21fe2b6FlNz_JjRfqcs2VTML4Te3k' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 7b270310-b1fe-2434-5f1d-d6a5d4c5db73'

Response

 [
{
"id": 44,
"username": "Steevwilliam",
"email": "steev@yahoomail.com",
"first_name": "Steev",
"last_name": "William",
"display_name": "Steev William",
"gender": "Male",
"state": "Tamil Nadu",
"created": "2016-09-28T18:44:54.081Z",
"students": {
"url": "http://demo.testpress.in/api/v2.2/admin/mentors/44/students/",
"students_count": 150
}
},
{
"id": 45,
"username": "Georgebobby",
"email": "george@hotmail.com",
"first_name": "George",
"last_name": "Bobby",
"display_name": "George Bobby",
"gender": "Male",
"state": "Tamil Nadu",
"created": "2016-09-28T19:06:18.177Z",
"students": {
"url": "http://demo.testpress.in/api/v2.2/admin/mentors/45/students/",
"students_count": 100
}
}
]

View Students

This endpoint allows you to view students of a particular mentor.

HTTP Request

GET /api/v2.2/admin/mentors/<:id>/students/

URL Parameters

ParameterDescription
idUnique Id of the mentor to retrieve

Response Fields

NameTypeDescription
idintUnique Id of the student
usernamestringUsername of the student
first_namestringFirst name of the student
last_namestringLast name of the student
display_namestringName of the student to be displayed
emailstringEmail of the student
photostringOriginal image of the student as uploaded
large_imagestringProfile image with size 256x256
medium_imagestringProfile image with size 128x128
small_imagestringProfile image with size 48x48
xsmall_imagestringProfile image with size 32x32
mini_imagestringProfile image with size 24x24
birth_datedatestringBirth date of student. Should be in DD/MM/YYYY format
gender_codestringGender of student. Can be "male", "female" or "trans"
genderstring(Read only) Human readable gender of student. Can be "Male", "Female" or "Transgender"
address1stringAddress of student
address2stringAddress of student
citystringCity of student
zipstringPincode of student
state_codestringState of student in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of student
batchesarrayBatches to which student has access
curl --request GET \
--url http://demo.testpress.in/api/v2.2/admin/mentors/1/students \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6InN0ZWVwaGFuc2VsdmFyYWpAdGVzdHByZXNzLmluIiwiZXhwIjoxNDc1MDYyMTkwfQ.iwVg_UM4HBB6qs21fe2b6FlNz_JjRfqcs2VTML4Te3k' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 14b92c4f-a0ad-fafb-67f4-5dc5d47ae832'

Response

[
{
"id": 2,
"url": "http://demo.testpress.in/api/v2.2/admin/users/2/",
"username": "testpress",
"first_name": "John",
"last_name": "Appleseed",
"display_name": "John Appleseed",
"email": "selvasteephandfasdfasdf@gmail.com",
"photo": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/d1b9192ef434443a963eced9b8747862.jpeg",
"large_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/2e6f0eb3bc9d467ab4254c094b47611e.jpeg",
"medium_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/7552ce50dff6479ba172f1102c56e72d.jpeg",
"small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/05764a619f09474d93caf0d49a43a4c0.jpeg",
"x_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/5ae9976cc2224e08ab81510404dd8c93.jpeg",
"mini_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/34d189e496f140b3aa772ee19df46e1b.jpeg",
"birth_date": "27/08/1994",
"gender_code": "male",
"gender": "Male",
"address1": "Chennai",
"address2": "Chennai",
"city": "Chennai",
"zip": "600069",
"state": "",
"state_code": "",
"phone": "9043570576",
"batches": [
{
"id": 30,
"name": "Testing Batch 1",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/30/"
},
{
"id": 29,
"name": "new sample batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/29/"
}
],
"batches_url": "http://demo.testpress.in/api/v2.2/admin/users/2/batches/"
},
{
"id": 345,
"url": "http://demo.testpress.in/api/v2.2/admin/users/345/",
"username": "hellouser",
"first_name": "hellouser",
"last_name": "",
"display_name": "hellouser",
"email": "testingsocialauth@gmail.com",
"photo": null,
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": "",
"birth_date": null,
"gender_code": null,
"gender": null,
"address1": "",
"address2": "",
"city": "",
"zip": "",
"state": "",
"state_code": "",
"phone": "9898989898",
"batches": [
{
"id": 40,
"name": "Payubatch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/40/"
},
{
"id": 29,
"name": "new sample batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/29/"
},
{
"id": 16,
"name": "EEE",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/16/"
}
],
"batches_url": "http://demo.testpress.in/api/v2.2/admin/users/345/batches/"
}
]

Add Students

This endpoint allows you to add a students to a mentor.

HTTP Request

POST /api/v2.2/admin/mentors/<:id>/students

URL Parameters

ParameterDescription
idUnique Id of the mentor to retrieve

POST data

ParameterDescription
students_usernameArray of students username

Response Fields

NameTypeDescription
idintUnique Id of the student
usernamestringUsername of the student
first_namestringFirst name of the student
last_namestringLast name of the student
display_namestringName of the student to be displayed
emailstringEmail of the student
photostringOriginal image of the student as uploaded
large_imagestringProfile image with size 256x256
medium_imagestringProfile image with size 128x128
small_imagestringProfile image with size 48x48
xsmall_imagestringProfile image with size 32x32
mini_imagestringProfile image with size 24x24
birth_datedatestringBirth date of student. Should be in DD/MM/YYYY format
gender_codestringGender of student. Can be "male", "female" or "trans"
genderstring(Read only) Human readable gender of student. Can be "Male", "Female" or "Transgender"
address1stringAddress of student
address2stringAddress of student
citystringCity of student
zipstringPincode of student
state_codestringState of student in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of student
batchesarrayBatches to which student has access
curl --request POST \
--url http://demo.testpress.in/api/v2.2/admin/mentors/1/students/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6InN0ZWVwaGFuc2VsdmFyYWpAdGVzdHByZXNzLmluIiwiZXhwIjoxNDc1MDYyMTkwfQ.iwVg_UM4HBB6qs21fe2b6FlNz_JjRfqcs2VTML4Te3k' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 30305f4a-5150-4ff7-5781-30f4ab972452' \
--data '{ \n "students_username": [ "john", "ragav"]\n}'

Response

[
{
"id": 2,
"url": "http://demo.testpress.in/api/v2.2/admin/users/2/",
"username": "john",
"first_name": "John",
"last_name": "Appleseed",
"display_name": "John Appleseed",
"email": "selvasteephandfasdfasdf@gmail.com",
"photo": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/d1b9192ef434443a963eced9b8747862.jpeg",
"large_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/2e6f0eb3bc9d467ab4254c094b47611e.jpeg",
"medium_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/7552ce50dff6479ba172f1102c56e72d.jpeg",
"small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/05764a619f09474d93caf0d49a43a4c0.jpeg",
"x_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/5ae9976cc2224e08ab81510404dd8c93.jpeg",
"mini_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/34d189e496f140b3aa772ee19df46e1b.jpeg",
"birth_date": "27/08/1994",
"gender_code": "male",
"gender": "Male",
"address1": "Chennai",
"address2": "Chennai",
"city": "Chennai",
"zip": "600069",
"state": "",
"state_code": "",
"phone": "9043570576",
"batches": [
{
"id": 30,
"name": "Testing Batch 1",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/30/"
},
{
"id": 29,
"name": "new sample batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/29/"
}
],
"batches_url": "http://demo.testpress.in/api/v2.2/admin/users/2/batches/"
},
{
"id": 345,
"url": "http://demo.testpress.in/api/v2.2/admin/users/345/",
"username": "ragav",
"first_name": "ragav",
"last_name": "",
"display_name": "ragav",
"email": "ragav@gmail.com",
"photo": null,
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": "",
"birth_date": null,
"gender_code": null,
"gender": null,
"address1": "",
"address2": "",
"city": "",
"zip": "",
"state": "",
"state_code": "",
"phone": "9898989898",
"batches": [
{
"id": 40,
"name": "Payubatch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/40/"
},
{
"id": 29,
"name": "new sample batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/29/"
},
{
"id": 16,
"name": "EEE",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/16/"
}
],
"batches_url": "http://demo.testpress.in/api/v2.2/admin/users/345/batches/"
}
]

Remove Students

This endpoint allows you to remove students from mentor.

HTTP Request

DELETE /api/v2.2/admin/mentors/<:id>/students

URL Parameters

ParameterDescription
idUnique Id of the mentor to retrieve

POST data

ParameterDescription
students_usernameArray of students username
curl --request DELETE \
--url http://demo.testpress.in/api/v2.2/admin/mentors/1/students/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6InN0ZWVwaGFuc2VsdmFyYWpAdGVzdHByZXNzLmluIiwiZXhwIjoxNDc1MDYyMTkwfQ.iwVg_UM4HBB6qs21fe2b6FlNz_JjRfqcs2VTML4Te3k' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 7cd40e60-ac91-ddc3-e493-b103a6b0c2e7' \
--data '{ \n "students_username": [ "john", "ragav"]\n}'

The above command on success will return 204 NO CONTENT

- + \ No newline at end of file diff --git a/docs/server-api/admin-apis/posts/index.html b/docs/server-api/admin-apis/posts/index.html index 082af2f..42c9412 100644 --- a/docs/server-api/admin-apis/posts/index.html +++ b/docs/server-api/admin-apis/posts/index.html @@ -4,13 +4,13 @@ Posts | Testpress docs - +

Posts

Posts are broadcast data which the institutes want to share to their users. This endpoint can be used to retrieve the posts created in your institute

Get All Posts

This endpoint retrieves all posts created by your institute admins

HTTP Request

GET /api/v2.2/admin/posts/

curl --request GET \
--url http://demo.testpress.in/api/v2.2/admin/posts/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"url": "http://demo.testpress.in/api/v2.2/admin/posts/sbbj-recruitment-20152016-sbbjbankcom-various-jobs-advt-apply-online/",
"created_by": {
"id": 16,
"url": "http://demo.testpress.in/api/v2.2/users/16/",
"username": "bharath",
"display_name": "Bharath Kumar S",
"first_name": "Bharath Kumar",
"last_name": "S",
"photo": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/cb88287098924bd6ae615ca4aa71eab5.png",
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": "",
"state": "",
"state_code": "",
"gender": "Male",
"gender_code": "male"
},
"category": {
"id": 1,
"name": "Alerts",
"color": "FF0000",
"slug": "alerts",
"is_starred": false
},
"created": "2015-09-24T10:00:16.609Z",
"modified": "2016-06-04T16:09:59.446Z",
"id": 1,
"is_active": true,
"title": "SBBJ Recruitment 2015\u20132016 sbbjbank.com Various Jobs Advt Apply Online",
"summary": "SBBJ Recruitment 2015\u20132016 sbbjbank.com Various Jobs Advt Apply Online\r\n",
"batches": [
{
"id": 17,
"name": "ECE",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/17/"
},
{
"id": 16,
"name": "EEE",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/16/"
}
],
"products": [],
"is_public": false,
"published_date": "2016-06-04T16:09:59.431Z"
},
{
"url": "http://demo.testpress.in/api/v2.2/admin/posts/sbi-recruitment-2015-2016-wwwsbicoin-manager-job-notification-online/",
"created_by": {
"id": 16,
"url": "http://demo.testpress.in/api/v2.2/users/16/",
"username": "bharath",
"display_name": "Bharath Kumar S",
"first_name": "Bharath Kumar",
"last_name": "S",
"photo": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/cb88287098924bd6ae615ca4aa71eab5.png",
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": "",
"state": "",
"state_code": "",
"gender": "Male",
"gender_code": "male"
},
"category": {
"id": 1,
"name": "Alerts",
"color": "FF0000",
"slug": "alerts",
"is_starred": false
},
"created": "2015-09-24T13:45:38.374Z",
"modified": "2016-06-04T16:09:59.664Z",
"id": 2,
"is_active": true,
"title": "SBI Recruitment 2015-2016 www.sbi.co.in Manager Job Notification Online",
"summary": "State Bank of India has unfolded a job notification of SBI Recruitment. Organization requires confident and responsible contenders for filling up the vacancies of Deputy General Manager (Law) Post....",
"batches": [
{
"id": 17,
"name": "ECE",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/17/"
},
{
"id": 16,
"name": "EEE",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/16/"
}
],
"products": [],
"is_public": false,
"published_date": "2016-06-04T16:09:59.656Z"
}
]
}

Get Single Post

This endpoint retrieves a single post.

Note: that some posts will return 403 Forbidden if they are not available for the authenticated user.

HTTP Request

GET /api/v2.2/posts/{slug}

URL Parameters

ParameterDescription
slugThe unique slug of the post to retrieve
curl --request GET \
--url http://demo.testpress.in/api/v2.2/admin/posts/working-great/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json'

Response

{
"url": "http://demo.testpress.in/api/v2.2/posts/working-great/",
"created_by": {
"id": 10,
"url": "http://demo.testpress.in/api/v2.2/users/10/",
"username": "admin",
"display_name": "admin",
"first_name": "",
"last_name": "",
"photo": "",
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": ""
},
"category": {
"id": 2,
"name": "Daliy News",
"color": "33CC33",
"slug": "daliy-news"
},
"created": "2.25-10-07T06:00:07Z",
"modified": "2.25-10-07T06:00:07Z",
"id": 26,
"active": true,
"title": "Working Great",
"summary": "All is Well",
"content_html": "<p>Good Better Best</p>",
"institute": 1
}

Create A Post

This endpoint creates a post for a batch / product in the given category

HTTP Request

POST /api/v2.2/admin/posts/

Fields

NameTypeDescription
urlstringUnique URL for the Post. This URL will be used to update / delete the post
titlestringPost Title
summarystringSummary of post
content_htmlstringContent of the post
batchesarray of stringsPass as array of batch name strings.
productsarray of stringsPass as array of product name strings
is_publicBooleanIs this a public post. True or False
categorystringCategory of the post.
curl -X POST -H "Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAzODY4NTV9.5w4InsvTPtQGgj4L1myQGc1qxw7IvNEpa3BtVfQOtxE" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: ababd89e-d515-7bca-b2a5-2a99a5a15d6d" -d '{
"title": "NCRA Recruitment 2015 www.ncra.tifr.res.in JRF Vacancies Apply Online",
"summary": "Test Summary",
"content_html": "<h2><strong>NCRA Recruitment</strong></h2> <p>National Centre for Radio Astrophysics, Pune has emitted an advertisement related to <strong>NCRA Recruitment</strong>. The organization is willing to hire self-motivated and expert candidates against vacancies of Junior Research Fellow (JRF) Post. Job Seekers who fulfill the eligibility criteria can apply against NCRA Recruitment 2015 by following online process. Job seekers who are eagerly waiting for jobs in this organization may apply against these Openings as soon as possible. Aspirants need to submit application form in proper manner on or prior to end date that is represented below.</p>",
"batches": [
"Online Test Batch"
],
"products": [
"IAS Prelims Power Pack"
],
"is_public": false,
"category": "Alerts",
"published_date": "2016-08-05T09:17:56.883Z"
}' "http://demo.testpress.in/api/v2.2/admin/posts/"

Response

{
"url": "http://demo.testpress.in/api/v2.2/admin/posts/ncra-recruitment-2015-wwwncratifrresin-jrf-vacancies-apply-online-14/",
"created_by": {
"id": 38,
"url": "http://demo.testpress.in/api/v2.2/users/38/",
"username": "admin",
"display_name": "admin",
"first_name": "",
"last_name": "",
"photo": "",
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": ""
},
"category": {
"id": 1,
"name": "Alerts",
"color": "FF0000",
"slug": "alerts",
"is_starred": false
},
"created": "2016-08-05T11:56:55.902Z",
"modified": "2016-08-05T11:56:55.940Z",
"id": 116,
"is_active": true,
"title": "NCRA Recruitment 2015 www.ncra.tifr.res.in JRF Vacancies Apply Online",
"summary": "Test Summary",
"batches": [
{
"id": 34,
"name": "Online Test Batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/34/"
}
],
"products": [
{
"id": 5,
"url": "http://demo.testpress.in/api/v2.2/products/ias-prelims-power-pack/",
"title": "IAS Prelims Power Pack",
"slug": "ias-prelims-power-pack",
"image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/c098795970e64bbab0265e82c4a40f6a.png",
"images": [
{
"original": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/c098795970e64bbab0265e82c4a40f6a.png",
"medium": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/2c5648e2884e481aa4256554ad601d66.png",
"small": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/a36d18c340c84e8eaa24d17697b1cb88.png"
}
],
"start_date": "2015-01-01T00:00:00+05:30",
"end_date": "2019-01-01T00:00:00+05:30",
"categories": [
"TNPSC"
],
"types": [
"Exams",
"Books"
],
"exams_count": 1,
"notes_count": 4,
"price": "1.00"
}
],
"is_public": false,
"published_date": "2016-08-05T09:17:56.883Z"
}

Update A Post

This endpoint updates details of the post with the given URL.

HTTP Request

PUT /api/v2.2/admin/posts/sbbj-recruitment/

Fields

NameTypeDescription
urlstringUnique URL for the Post
titlestringPost Title
summarystringSummary of post
content_htmlstringContent of the post
batchesarray of stringsPass as array of batch name strings.
productsarray of stringsPass as array of product name strings
is_publicBooleanIs this a public post. True or False
categorystringCategory of the post.
curl -X GET -H "Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAzODY4NTV9.5w4InsvTPtQGgj4L1myQGc1qxw7IvNEpa3BtVfQOtxE" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 885de78c-74d5-77d3-4da7-751d4020d920" "http://demo.testpress.in/api/v2.2/admin/posts/sbbj-recruitment/"

Response

{
"url": "http://demo.testpress.in/api/v2.2/admin/posts/sbbj-recruitment/",
"created_by": {
"id": 38,
"url": "http://demo.testpress.in/api/v2.2/users/38/",
"username": "admin",
"display_name": "admin",
"first_name": "",
"last_name": "",
"photo": "",
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": ""
},
"category": {
"id": 1,
"name": "Alerts",
"color": "FF0000",
"slug": "alerts",
"is_starred": false
},
"created": "2015-10-06T08:51:02.327Z",
"modified": "2016-08-12T13:23:00.959Z",
"id": 26,
"is_active": true,
"title": "NCRA Recruitment 2015 www.ncra.tifr.res.in JRF Vacancies Apply Online",
"summary": "Test Summary",
"content_html": "<h2><strong>NCRA Recruitment</strong></h2> <p>National Centre for Radio Astrophysics, Pune has emitted an advertisement related to <strong>NCRA Recruitment</strong>. The organization is willing to hire self-motivated and expert candidates against vacancies of Junior Research Fellow (JRF) Post. Job Seekers who fulfill the eligibility criteria can apply against NCRA Recruitment 2015 by following online process. Job seekers who are eagerly waiting for jobs in this organization may apply against these Openings as soon as possible. Aspirants need to submit application form in proper manner on or prior to end date that is represented below.</p>",
"batches": [
{
"id": 34,
"name": "Online Test Batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/34/"
}
],
"products": [
{
"id": 5,
"url": "http://demo.testpress.in/api/v2.2/products/ias-prelims-power-pack/",
"title": "IAS Prelims Power Pack",
"slug": "ias-prelims-power-pack",
"image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/c098795970e64bbab0265e82c4a40f6a.png",
"images": [
{
"original": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/c098795970e64bbab0265e82c4a40f6a.png",
"medium": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/2c5648e2884e481aa4256554ad601d66.png",
"small": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/a36d18c340c84e8eaa24d17697b1cb88.png"
}
],
"start_date": "2015-01-01T00:00:00+05:30",
"end_date": "2019-01-01T00:00:00+05:30",
"categories": [
"TNPSC"
],
"types": [
"Exams",
"Books"
],
"exams_count": 1,
"notes_count": 4,
"price": "1.00"
}
],
"is_public": false,
"published_date": "2015-10-06T08:51:02Z"
}}

Delete A Post

This endpoint delete a post with the given URL.

HTTP Request

DELETE /api/v2.2/admin/posts/expected-questions-seating-arrangements/

curl -X DELETE -H "Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAzODY4NTV9.5w4InsvTPtQGgj4L1myQGc1qxw7IvNEpa3BtVfQOtxE" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 2cfea85b-fc7d-c378-8151-4a1731d1fd5e" -d '{
"title": "NCRA Recruitment 2015 www.ncra.tifr.res.in JRF Vacancies Apply Online",
"summary": "Test Summary",
"content_html": "<h2><strong>NCRA Recruitment</strong></h2> <p>National Centre for Radio Astrophysics, Pune has emitted an advertisement related to <strong>NCRA Recruitment</strong>. The organization is willing to hire self-motivated and expert candidates against vacancies of Junior Research Fellow (JRF) Post. Job Seekers who fulfill the eligibility criteria can apply against NCRA Recruitment 2015 by following online process. Job seekers who are eagerly waiting for jobs in this organization may apply against these Openings as soon as possible. Aspirants need to submit application form in proper manner on or prior to end date that is represented below.</p>",
"batches": [
"Online Test Batch"
],
"products": [
"IAS Prelims Power Pack"
],
"is_public": false,
"category": "Alerts"
}' "http://demo.testpress.in/api/v2.2/admin/posts/expected-questions-seating-arrangements/"''''


Response

The above command returns with status 204

- + \ No newline at end of file diff --git a/docs/server-api/admin-apis/users/index.html b/docs/server-api/admin-apis/users/index.html index 75ad172..dc48065 100644 --- a/docs/server-api/admin-apis/users/index.html +++ b/docs/server-api/admin-apis/users/index.html @@ -4,13 +4,13 @@ Users | Testpress docs - +

Users

Admin APIs require authorization token with admin privileges. You check the following link to generate authorization token. You need to provide admin username and password to generate token with admin privileges.

Authentication

Admin Users API gives you access to create/edit users in the institute.

Create User

This endpoint creates a user.

HTTP Request

POST /api/v2.5/admin/users/

You can optionally add a batches field in the POST data with an array of batch names. The user will automatically get added to those batches during creation.

Except for username and password, all other fields are optional.

Fields

NameTypeDescription
usernamestringUsername of the user
first_namestringFirst name of the user
last_namestringLast of the user
emailstringEmail of the user
birth_datedatestringBirth date of user. Should be in DD/MM/YYYY format
address1stringAddress of the user
address2stringAddress of the user
citystringCity of the user
zipstringPincode of the user
statestringState of user in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of the user
batcheslistBatches of the user
expiresdatestringExpiry date of the batches subscription. Format yyyy-mm-dd. After which the user will be removed form the batch
custom_fieldsjsonA dictionary containing custom field name and the response to be recorded for the user. The custom field name is case-insensitive.
curl --request POST \
--url http://demo.testpress.in/api/v2.5/admin/users/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAyMjk2MDd9.ynLE30wWup2CXMqgpNjT4ZBAUAtttqebzat-stuVB84' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"username": "lorem", "password": "ipsum1$", "first_name": "John", "last_name": "Appleseed", "email": "test@example.com", "birth_date": "03/07/2016", "state": "IN-TN", "batches": ["Test Batch", "UPSC Morning Batch"],"expires":"2023-01-13", "custom_fields": {"Graduation University": "Delhi University", "Graduation Year": 2020}}'

Response

{
"id": 1892,
"url": "http://demo.testpress.in/api/v2.5/admin/users/1892/",
"username": "lorem",
"first_name": "John",
"last_name": "Appleseed",
"display_name": "John Appleseed",
"email": "test@example.com",
"photo": null,
"birth_date": "03/07/2016",
"address1": "",
"address2": "",
"city": "",
"zip": "",
"state": "Tamil Nadu",
"state_code": "IN-TN",
"phone": "",
"batches_url": "http://demo.testpress.in/api/v2.5/admin/users/1892/batches/",
"custom_fields": {
"Graduation University": "Delhi University",
"Graduation Year": 2020
}
}

View All Users

This endpoint allows you to get all users.

HTTP Request

GET /api/v2.5/admin/users/

Query Parameters

ParameterTypeDescription
qstringFilters by Username or Email

Examples:

/api/v2.5/admin/users/?q=john

/api/v2.5/admin/users/?q=test@gmail.com

Fields

NameTypeDescription
usernamestringUsername of the user
first_namestringFirst name of the user
last_namestringLast of the user
display_namestringName of the user to be displayed
emailstringEmail of the user
photostringOriginal image of the user as uploaded
birth_datedatestringBirth date of user. Should be in DD/MM/YYYY format
genderstring(Read only) Human readable gender of user. Can be "Male", "Female" or "Transgender"
address1stringAddress of the user
address2stringAddress of the user
citystringCity of the user
zipstringPincode of the user
statestringState of user in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of the user
curl --request GET \
--url http://demo.testpress.in/api/v2.5/admin/users/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAzNDI4NTB9.Dsc2NZ_q0e3GRaBTArgwkPs81RbQEt-FnH0u_TBs2hc' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"username": "admin15", "password": "demouser", "first_name": "Cool", "last_name": "dude", "email": "cool@dude.com", "birth_date": "03/07/2016", "state": "IN-TN"\n}'

Response

{
"count": 756,
"next": "https://demo.testpress.in/api/v2.5/admin/users/?page=2",
"previous": null,
"per_page": 20,
"results": [

{
"id": 1889,
"url": "http://demo.testpress.in/api/v2.5/admin/users/",
"username": "lorem",
"first_name": "John",
"last_name": "Appleseed",
"display_name": "John Appleseed",
"email": "test@example.com",
"photo": null,
"birth_date": "03/07/2016",
"address1": "",
"address2": "",
"city": "",
"zip": "",
"state": "IN-TN",
"phone": "",
"batches_url": "http://demo.testpress.in/api/v2.5/admin/users/1/batches/"
},

{
"id": 1890,
"url": "http://demo.testpress.in/api/v2.5/admin/users/",
"username": "lorem2",
"first_name": "John2",
"last_name": "Appleseed",
"display_name": "John Appleseed",
"email": "test3@example.com",
"photo": null,
"birth_date": "23/07/2000",
"address1": "",
"address2": "",
"city": "",
"zip": "",
"state": "IN-TN",
"phone": "",
"batches_url": "http://demo.testpress.in/api/v2.5/admin/users/2/batches/"
}

]

}


View User

This endpoint allows you to view details of a particular user.

HTTP Request

GET /api/v2.5/admin/users/<:id>

URL Parameters

ParametterDescription
idUnique Id of the user to retrieve

Fields

NameTypeDescription
usernamestringUsername of the user
first_namestringFirst name of the user
last_namestringLast of the user
display_namestringName of the user to be displayed
emailstringEmail of the user
photostringOriginal image of the user as uploaded
birth_datedatestringBirth date of user. Should be in DD/MM/YYYY format
genderstring(Read only) Human readable gender of user. Can be "Male", "Female" or "Transgender"
address1stringAddress of the user
address2stringAddress of the user
citystringCity of the user
zipstringPincode of the user
statestringState of user in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of the user
curl --request GET \
--url http://demo.testpress.in/api/v2.5/admin/users/1889/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAzNDI4NTB9.Dsc2NZ_q0e3GRaBTArgwkPs81RbQEt-FnH0u_TBs2hc' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"username": "admin15", "password": "demouser", "first_name": "Cool", "last_name": "dude", "email": "cool@dude.com", "birth_date": "03/07/2016", "state": "IN-TN"\n}'

Response

{
"id": 1889,
"url": "http://demo.testpress.in/api/v2.5/admin/users/1889/",
"username": "lorem",
"first_name": "John",
"last_name": "Appleseed",
"display_name": "John Appleseed",
"email": "test@example.com",
"photo": null,
"birth_date": "03/07/2016",
"address1": "",
"address2": "",
"city": "",
"zip": "",
"state": "IN-TN",
"phone": "",
"batches_url": "http://demo.testpress.in/api/v2.5/admin/users/1889/batches/"
}

Update User

This endpoint allows you to update details of a particular user.

HTTP Request

PUT /api/v2.5/admin/users/<:id>

URL Parameters

ParametterDescription
idUnique Id of the user to update

Fields

NameTypeDescription
usernamestringUsername of the user
passwordstringPassword to update the user
first_namestringFirst name of the user
last_namestringLast of the user
display_namestringName of the user to be displayed
emailstringEmail of the user
photostringOriginal image of the user as uploaded
birth_datedatestringBirth date of user. Should be in DD/MM/YYYY format
genderstring(Read only) Human readable gender of user. Can be "Male", "Female" or "Transgender"
address1stringAddress of the user
address2stringAddress of the user
citystringCity of the user
zipstringPincode of the user
statestringState of user in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of the user
is_activebooleanUsed to activate/deactivate the user. Accepts "true"/"false".
custom_fieldsjsonA dictionary containing custom field name and the response to be recorded for the user. The custom field name is case-insensitive.

Read Only Fields

password_hash, gender, state, large_image, medium_image, medium_small_image, small_image, xsmall_image, mini_image, created, modified

Write Only Fields

password

url --request PUT \
--url http://demo.testpress.in/api/v2.5/admin/users/2120/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAzNDI4NTB9.Dsc2NZ_q0e3GRaBTArgwkPs81RbQEt-FnH0u_TBs2hc' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 5bdb17f6-db4d-c72e-a30f-c1776f0d8384' \
--data '{\n "password": "welcome"\n}'

Response

{
"id": 2120,
"username": "goodboy",
"password_hash": "pbkdf2_sha256$12000$zaz1v370q51a$ipNrjQCWNOAmdFsHWPHHZ1i1+5hxF5LxHZ+VfFZ9mrM=",
"email": "",
"first_name": "",
"last_name": "",
"display_name": "goodboy",
"photo": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/png/3a6be029faea4c41915291da8778c36d.png",
"birth_date": null,
"address1": "",
"address2": "",
"city": "",
"zip": "",
"state": "",
"state_code": "",
"phone": "",
"batches_url": "http://demo.testpress.in/api/v2.5/admin/users/2120/batches/",
"url": "http://demo.testpress.in/api/v2.5/admin/users/2120/",
"created": "2017-08-03T18:25:45.949568Z",
"modified": "2017-08-03T18:29:24.712464Z",
"custom_fields": {
"Graduation University": "Delhi University",
"Graduation Year": 2020
}
}

Delete User

This endpoint allows you to delete particular user. Please be aware this will delete all the data related to the user. The operation is ir reversible

HTTP Request

DELETE /api/v2.2/admin/users/<:id>

URL Parameters

ParametterDescription
idUnique Id of the user to retrieve

View User By Email

This endpoint allows you to view details of a particular user by email address

HTTP Request

GET /api/v2.5/admin/users/?email=<:email_id>

URL Parameters

ParametterDescription
idEmail Address of the user

Fields

NameTypeDescription
usernamestringUsername of the user
first_namestringFirst name of the user
last_namestringLast of the user
display_namestringName of the user to be displayed
emailstringEmail of the user
photostringOriginal image of the user as uploaded
large_imagestringProfile image with size 256x256
medium_imagestringProfile image with size 128x128
small_imagestringProfile image with size 48x48
xsmall_imagestringProfile image with size 32x32
mini_imagestringProfile image with size 24x24
birth_datedatestringBirth date of user. Should be in DD/MM/YYYY format
gender_codestringGender of user. Can be "male", "female" or "trans"
genderstring(Read only) Human readable gender of user. Can be "Male", "Female" or "Transgender"
address1stringAddress of the user
address2stringAddress of the user
citystringCity of the user
zipstringPincode of the user
state_codestringState of user in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of the user
batchesarrayBatches to which user has access
curl -X GET -H "Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAzODY4NTV9.5w4InsvTPtQGgj4L1myQGc1qxw7IvNEpa3BtVfQOtxE" -H "Cache-Control: no-cache" -H "Postman-Token: c8cbe2a1-76d0-da3a-1bbb-38cd3f61f215" "http://demo.testpress.in//api/v2.5/admin/users/?email=bharathwaaj.s@gmail.com"

Response

{
"count": 1,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"id": 36,
"url": "http://demo.testpress.in/api/v2.2/admin/users/36/",
"username": "bharath",
"first_name": "Bharath Kumar",
"last_name": "S",
"display_name": "Bharath Kumar S",
"email": "bharathwaaj.s@gmail.com",
"photo": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/cb88287098924bd6ae615ca4aa71eab5.png",
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": "",
"birth_date": "17/08/1987",
"gender_code": "male",
"gender": "Male",
"address1": "257 A Timber Mill Road",
"address2": "4th Cross, New Thippasandra",
"city": "Bangalore",
"zip": "560075",
"state": "",
"state_code": "",
"phone": "9787231006",
"batches": [
{
"id": 26,
"name": "UPSC Evening Batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/26/"
},
{
"id": 25,
"name": "IBPS Online Batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/25/"
},
{
"id": 24,
"name": "NEET Morning Batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/24/"
},
{
"id": 23,
"name": "UPSC Morning Batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/23/"
},
{
"id": 22,
"name": "IBPS Morning Batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/22/"
},
{
"id": 21,
"name": "st std A",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/21/"
},
{
"id": 20,
"name": "OHC 2013",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/20/"
},
{
"id": 19,
"name": "POZITIVE ONLINE TEST SERIES",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/19/"
},
{
"id": 18,
"name": "Unique UPSC Batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/18/"
}
],
"batches_url": "http://demo.testpress.in/api/v2.2/admin/users/36/batches/"
}
]
}

View Batches

This endpoint allows you to view batches of a particular user.

HTTP Request

GET /api/v2.5/admin/users/<id>/batches/

URL Parameters

ParametterDescription
idUnique Id of the user to retrieve

Response Fields

NameTypeDescription
idstringId of the batch
urlstringUnique endpoint of that batch
namestringName of the batch
curl --request GET \
--url http://demo.testpress.in/api/v2.5/admin/users/1892/batches/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAyMjk2MDd9.ynLE30wWup2CXMqgpNjT4ZBAUAtttqebzat-stuVB84' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"id": 29,
"name": "Test Batch",
},
{
"id": 23,
"name": "UPSC Morning Batch",
}
]
}

Add Batches

This endpoint allows you to add users to batches

HTTP Request

POST /api/v2.5/admin/users/<id>/batches/

URL Parameters

ParametterDescription
idUnique Id of the user to retrieve

Response Fields

NameTypeDescription
idstringId of the batch
urlstringUnique endpoint of that batch
namestringName of the batch
curl --request POST \
--url http://demo.testpress.in/api/v2.5/admin/users/1892/batches/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAyMjk2MDd9.ynLE30wWup2CXMqgpNjT4ZBAUAtttqebzat-stuVB84' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"batches": [24, 22]}'

Response

[
{
"id": 29,
"name": "Test Batch",
},
{
"id": 24,
"name": "NEET Morning Batch",
},
{
"id": 23,
"name": "UPSC Morning Batch",
},
{
"id": 22,
"name": "IBPS Morning Batch",
}
]

Remove Batches

This endpoint allows you to add users to batches

HTTP Request

DELETE /api/v2.5/admin/users/<id>/batches/

URL Parameters

ParametterDescription
idUnique Id of the user to retrieve

POST data

ParametterDescription
batchesList of batch ids
curl --request DELETE \
--url http://demo.testpress.in/api/v2.5/admin/users/1892/batches/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAyMjk2MDd9.ynLE30wWup2CXMqgpNjT4ZBAUAtttqebzat-stuVB84' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"batches": [24, 22]}'

Response

The above command on success will return 204 NO CONTENT

Add Courses

This endpoint allows you to add courses to a user

HTTP Request

POST /api/v2.5/admin/users/<id>/courses/

URL Parameters

ParametterDescription
idUnique Id of the user to retrieve

POST data

ParametterDescription
coursesList of course ids
curl --request POST \
--url http://lmsdemo.testpress.in/api/v2.5/admin/users/1892/courses/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAyMjk2MDd9.ynLE30wWup2CXMqgpNjT4ZBAUAtttqebzat-stuVB84' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"courses": [278, 279]}'

Response

{
"count": 5,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"id": 278,
"title": "Master of Business Administration",
"slug": "master-of-business-administration",
"description": "",
"image": "https://static.testpress.in/institute/lmsdemo/custom_icons/0351510ee9254487a6d393f966d0f2f3.jpg",
"is_public": true,
"created": "2020-12-09T09:39:53.863767Z",
"modified": "2020-12-14T12:58:36.148936Z",
"enable_progressive_lock": false,
"order": 8,
"url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/278/",
"batches_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/278/batches/",
"chapters_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/278/chapters/",
"contents_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/278/contents/"
},
{
"id": 279,
"title": "Language training",
"slug": "language-training",
"description": "",
"image": "https://static.testpress.in/institute/lmsdemo/custom_icons/e293fdefcfdc46a8892ca12a0bdbb7cc.jpg",
"is_public": true,
"created": "2020-12-09T09:56:31.350026Z",
"modified": "2020-12-12T10:17:05.427842Z",
"enable_progressive_lock": false,
"order": 9,
"url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/279/",
"batches_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/279/batches/",
"chapters_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/279/chapters/",
"contents_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/279/contents/"
},
{
"id": 280,
"title": "Entrance Coaching",
"slug": "entrance-coaching",
"description": "",
"image": "https://static.testpress.in/institute/lmsdemo/custom_icons/421d84a1778a4c55a6b6ceaac1e540e7.jfif",
"is_public": true,
"created": "2020-12-09T09:59:48.392077Z",
"modified": "2020-12-12T10:17:05.427842Z",
"enable_progressive_lock": false,
"order": 10,
"url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/280/",
"batches_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/280/batches/",
"chapters_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/280/chapters/",
"contents_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/280/contents/"
},
{
"id": 281,
"title": "Skill Development Training",
"slug": "skill-development-training",
"description": "",
"image": "https://static.testpress.in/institute/lmsdemo/custom_icons/a3687fd5094042ddb8ab043eecf1d2d2.jpg",
"is_public": true,
"created": "2020-12-09T10:00:58.923825Z",
"modified": "2020-12-12T10:17:05.427842Z",
"enable_progressive_lock": false,
"order": 11,
"url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/281/",
"batches_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/281/batches/",
"chapters_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/281/chapters/",
"contents_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/281/contents/"
},
{
"id": 283,
"title": "TD",
"slug": "td",
"description": "",
"image": "https://static.testpress.in/institute/lmsdemo/custom_icons/26759ff073e34454945f5ea867e7afee.png",
"is_public": false,
"created": "2020-12-11T10:37:20.205025Z",
"modified": "2020-12-13T17:15:37.681858Z",
"enable_progressive_lock": false,
"order": 7,
"url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/283/",
"batches_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/283/batches/",
"chapters_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/283/chapters/",
"contents_url": "https://lmsdemo.testpress.in/api/v2.5/admin/courses/283/contents/"
}
]
}

Remove Courses

This endpoint allows you to remove courses from a user

HTTP Request

DELETE /api/v2.5/admin/users/<id>/courses/

URL Parameters

ParametterDescription
idUnique Id of the user to retrieve

POST data

ParametterDescription
coursesList of course ids that needs to be removed user
curl --request DELETE \
--url http://lmsdemo.testpress.in/api/v2.5/admin/users/1892/courses/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAyMjk2MDd9.ynLE30wWup2CXMqgpNjT4ZBAUAtttqebzat-stuVB84' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"courses": [24, 22]}'

Response

The above command on success will return 204 NO CONTENT

View User Subscriptions

This endpoint allows you to view subscriptions of a particular user.

HTTP Request

GET /api/v2.5/admin/users/<id>/subscriptions/

URL Parameters

ParametterDescription
idUnique Id of the user to retrieve

Response Fields

NameTypeDescription
idstringId of the user subsciption
batch.idstringId of the batch
batch.urlstringUnique endpoint of that batch
batch.namestringName of the batch
expiresdatestringExpiry date of the batches subscription. Format yyyy-mm-dd. After which the user will be removed form the batch
curl --request GET \
--url http://demo.testpress.in/api/v2.5/admin/users/1892/subscriptions/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAyMjk2MDd9.ynLE30wWup2CXMqgpNjT4ZBAUAtttqebzat-stuVB84' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"id":70,
"batch": {
"id": 85,
"name": "Test Batch",
"url": "http://demo.testbench.in:8000/api/v2.5/admin/batches/85/",
"created": "2023-01-12T11:06:19.298526+05:30",
"modified": "2023-01-12T11:06:19.298526+05:30",
"is_local": false
},
"expires": "2023-01-13"
},
{
"id":33,
"batch": {
"id": 86,
"name": "UPSC Batch",
"url": "http://demo.testbench.in:8000/api/v2.5/admin/batches/86/",
"created": "2023-01-12T11:07:16.060993+05:30",
"modified": "2023-01-12T11:07:16.060993+05:30",
"is_local": false
},
"expires": "2023-01-13"
}
]
}

Add User Subscriptions

This endpoint allows you to add users to a subscription

HTTP Request

POST /api/v2.5/admin/users/<id>/subscriptions/

URL Parameters

ParametterDescription
idUnique Id of the user to retrieve

Fields

NameTypeDescription
batcheslistBatch ids
expiresdatestringExpiry date of the batches subscription. Format yyyy-mm-dd. After which the user will be removed form the batch
curl --request POST \
--url http://demo.testpress.in/api/v2.5/admin/users/1892/subscriptions/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAyMjk2MDd9.ynLE30wWup2CXMqgpNjT4ZBAUAtttqebzat-stuVB84' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"batches": [24, 22],"expires":"2023-01-13"}'

Response

[
{
"id": 33,
"batch": {
"id": 85,
"name": "Test Batch",
"url": "http://demo.testbench.in:8000/api/v2.5/admin/batches/85/",
},
"expires": "2023-01-13"
},
{
"id": 34,
"batch": {
"id": 86,
"name": "UPSC Batch",
"url": "http://demo.testbench.in:8000/api/v2.5/admin/batches/86/",
},
"expires": "2023-01-13"
}
]
- + \ No newline at end of file diff --git a/docs/server-api/admin-apis/videos/index.html b/docs/server-api/admin-apis/videos/index.html index 6deb0ec..341ac48 100644 --- a/docs/server-api/admin-apis/videos/index.html +++ b/docs/server-api/admin-apis/videos/index.html @@ -4,13 +4,13 @@ Videos | Testpress docs - +

Videos

info

Admin APIs require authorization token with admin privileges. You check the following link to generate an authorization token. You need to provide an admin username and password to generate token with admin privileges.

Authentication

The Video API allows admin to access and read all videos.

Get Watched Videos of User

This endpoint can be used to retrieve the videos watched by a particular user.

HTTP Request

GET /api/v2.5/admin/users/<id>/videos_watched/

URL Parameters

ParameterDescription
idUnique Id of the user

Query Parameters

ParameterTypeDescription
start_datestringStart date in the format yyyy-mm-dd
end_datestringEnd date in the format yyyy-mm-dd
coursestringUnique course ID
chapterstringUnique chapter ID

Example:

/api/v2.5/admin/users/10/videos_watched/?start_date=2023-12-29&end_date=2024-05-29&course=14

This endpoint will get the list of videos watched by user with ID 10 from the course with ID 14 from December 29, 2023, to May 29, 2024.

curl --request GET \
--url http://demo.testpress.in/api/v2.5/admin/users/60386/videos_watched/
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 2,
"next": "https://lmsdemo.testpress.in/api/v2.5/admin/users/60386/videos_watched/?page=2",
"previous": null,
"per_page": 20,
"results": [
{
"id": 3651,
"title": "Rad1",
"watched_duration": null,
"total_duration": null,
"created": "2024-05-09T12:25:13.267531+05:30",
"watched_percentage": 0,
"remaining_duration": null,
"course_title": "UPSC Course",
"chapter_name": "Radical",
"content_created_date": "2024-04-24T14:08:11+05:30"
},
{
"id": 3689,
"title": "Video 6",
"watched_duration": "12 seconds",
"total_duration": "30 seconds",
"created": "2024-05-28T11:39:06.034546+05:30",
"watched_percentage": 40,
"remaining_duration": "18 seconds",
"course_title": "Orange Muttai 1",
"chapter_name": "Video",
"content_created_date": "2022-12-01T17:28:07+05:30"
}
]
}
- + \ No newline at end of file diff --git a/docs/server-api/students-apis/attempts/index.html b/docs/server-api/students-apis/attempts/index.html index afcf751..b8b9d88 100644 --- a/docs/server-api/students-apis/attempts/index.html +++ b/docs/server-api/students-apis/attempts/index.html @@ -4,13 +4,13 @@ Attempts | Testpress docs - +

Attempts

Attempts API gives you access to read all the attempts which can be accessed by the authenticated user.

Get All Attempts

This endpoint retrieves all attempts for the authenticated user.

HTTP Request

GET /api/v2.2/attempts/

Query Parameter

ParameterTypeDescription
coursestringFilters by course name. Ex: IBPS
qstringFilters by exam title. Useful to search by exam title.
curl --request GET \
--url http://demo.testpress.in/api/v2.2/attempts/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"url": "http://demo.testpress.in/api/v2.2/attempts/125894/",
"id": 125894,
"exam": {
"url": "http://demo.testpress.in/api/v2.2/exams/forum-ias-rbi-demo/",
"id": 3720,
"title": "FORUM IAS RBI DEMO",
"description": "",
"course": "TNPSC",
"start_date": "2.25-11-07T12:37:11+05:30",
"end_date": "2.25-11-15T12:37:11+05:30",
"duration": "3:00:00",
"number_of_questions": 200,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 2,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"allow_pdf": false,
"created": "2.25-11-07T07:07:41.597Z",
"slug": "forum-ias-rbi-demo",
"variable_mark_per_question": false,
"show_answers": true
},
"user": "testpress",
"date": "2.25-11-07T07:12:49.873Z",
"total_questions": 200,
"score": "0.00",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/125894/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/125894/questions/",
"percentile": 0,
"correct_count": 0,
"incorrect_count": 0,
"last_started_time": "2.25-11-07T08:02:46.845Z",
"remaining_time": "2.20:03",
"time_taken": "0:49:57",
"state": "Running",
"rank": "NA",
"max_rank": 0,
"percentage": "0",
"unanswered_count": 0,
"commented_questions_count": 0,
"comments_count": 0,
"allow_retake": true,
"remaining_attempts": null,
"total_bonus": 0
},
{
"url": "http://demo.testpress.in/api/v2.2/attempts/125872/",
"id": 125872,
"exam": {
"url": "http://demo.testpress.in/api/v2.2/exams/aiims-exam/",
"id": 3625,
"title": "AIIMS Exam",
"description": "",
"course": "TNPSC",
"start_date": "2.25-10-20T18:12:26+05:30",
"end_date": null,
"duration": "3:12:27",
"number_of_questions": 200,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 3,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": true,
"rank_publishing_date": "2.25-10-20T12:42:44Z",
"allow_pdf": false,
"created": "2.25-10-20T12:43:01.684Z",
"slug": "aiims-exam",
"variable_mark_per_question": false,
"show_answers": true
},
"user": "testpress",
"date": "2.25-11-07T06:17:42.313Z",
"total_questions": 200,
"score": "0.00",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/125872/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/125872/questions/",
"percentile": 60,
"correct_count": 0,
"incorrect_count": 0,
"last_started_time": "2.25-11-07T06:17:42.375Z",
"remaining_time": "3:12:26",
"time_taken": "0:00:01",
"state": "Completed",
"rank": 4,
"max_rank": 5,
"percentage": "0",
"unanswered_count": 200,
"commented_questions_count": 0,
"comments_count": 0,
"allow_retake": true,
"remaining_attempts": null,
"total_bonus": 0
}
]
}


Get All Atempts Of An Exam

This endpoint retrieves the attempts of a user for a particular exam.

HTTP Request

GET /api/v2.2/exams/<slug>/attempts/

URL Parameter

ParameterDescription
slugThe unique slug of the exam for which the attempts should be retrieved
curl --request GET \
--url http://demo.testpress.in/api/v2.2/exams/mathjax-sample-exam/attempts/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response


{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"url": "http://demo.testpress.in/api/v2.2/attempts/369/",
"id": 369,
"user": {
"id": 5,
"url": "http://demo.testpress.in/api/v2.2/users/5/",
"username": "demouser",
"display_name": "DemoUser is my name eeeeee123456789012345678901234",
"first_name": "DemoUser is my name eeeeee123456789012345678901234",
"last_name": "",
"photo": "https://media.testpress.in/i/bc194c3b0f3241ad9473edf949de3cec.jpeg",
"large_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/459b2af2355549dc8d7f411553128903.jpeg",
"medium_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/05c3efc7e4e3454ebad1c32c0c69297c.jpeg",
"medium_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/ca7ae15e26cc4586ae5f98750c2acc62.jpeg",
"small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/33936fd431e14a9ab54d7e24e70bf301.jpeg",
"x_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/673ceb6e18b343318fba39279ef07594.jpeg",
"mini_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/3214f5359ad247d1b2e38609376af72b.jpeg"
},
"date": "2017-04-25T14:34:26.848Z",
"total_questions": 25,
"score": "0.00",
"review_pdf_url": "",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/369/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/369/questions/",
"percentile": 0,
"correct_count": 0,
"incorrect_count": 0,
"last_started_time": "2017-05-11T12:26:08.889Z",
"remaining_time": "1:09:31",
"time_taken": "1:50:29",
"state": "Running",
"rank": 2,
"max_rank": 165,
"percentage": "0",
"unanswered_count": 0,
"rank_enabled": true,
"sections": [],
"speed": 0,
"accuracy": 0
},
{
"url": "http://demo.testpress.in/api/v2.2/attempts/12/",
"id": 12,
"user": {
"id": 5,
"url": "http://demo.testpress.in/api/v2.2/users/5/",
"username": "demouser",
"display_name": "DemoUser is my name eeeeee123456789012345678901234",
"first_name": "DemoUser is my name eeeeee123456789012345678901234",
"last_name": "",
"photo": "https://media.testpress.in/i/bc194c3b0f3241ad9473edf949de3cec.jpeg",
"large_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/459b2af2355549dc8d7f411553128903.jpeg",
"medium_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/05c3efc7e4e3454ebad1c32c0c69297c.jpeg",
"medium_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/ca7ae15e26cc4586ae5f98750c2acc62.jpeg",
"small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/33936fd431e14a9ab54d7e24e70bf301.jpeg",
"x_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/673ceb6e18b343318fba39279ef07594.jpeg",
"mini_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/3214f5359ad247d1b2e38609376af72b.jpeg"
},
"date": "2017-01-24T06:33:09.230Z",
"total_questions": 16,
"score": "3.00",
"review_pdf_url": "",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/12/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/12/questions/",
"percentile": 83.64,
"correct_count": 0,
"incorrect_count": 0,
"last_started_time": "2017-01-24T06:33:51.754Z",
"remaining_time": "2:59:17",
"time_taken": "0:00:43",
"state": "Completed",
"rank": 2,
"max_rank": 165,
"percentage": "12",
"unanswered_count": 0,
"rank_enabled": true,
"sections": [],
"speed": 847,
"accuracy": 30
}
]
}


Get A Single Attempt

This endpoint retrieves a single attempt.

caution

Note that some attempts will return 403 Forbidden if they do not belong to the authenticated user.

HTTP Request

GET /api/v2.2/attempts/<id>

URL Parameters

ParameterDescription
idThe unique id of the attempt to retrieve
curl --request GET \
--url http://demo.testpress.in/api/v2.2/attempts/125894/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"url": "http://demo.testpress.in/api/v2.2/attempts/125894/",
"id": 125894,
"exam": {
"url": "http://demo.testpress.in/api/v2.2/exams/forum-ias-rbi-demo/",
"id": 3720,
"title": "FORUM IAS RBI DEMO",
"description": "",
"course": "TNPSC",
"start_date": "2.25-11-07T12:37:11+05:30",
"end_date": "2.25-11-15T12:37:11+05:30",
"duration": "3:00:00",
"number_of_questions": 200,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 2,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"allow_pdf": false,
"created": "2.25-11-07T07:07:41.597Z",
"slug": "forum-ias-rbi-demo",
"variable_mark_per_question": false,
"show_answers": true
},
"user": "testpress",
"date": "2.25-11-07T07:12:49.873Z",
"total_questions": 200,
"score": "0.00",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/125894/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/125894/questions/",
"percentile": 0,
"correct_count": 0,
"incorrect_count": 0,
"last_started_time": "2.25-11-07T08:02:46.845Z",
"remaining_time": "2.20:03",
"time_taken": "0:49:57",
"state": "Running",
"rank": "NA",
"max_rank": 0,
"percentage": "0",
"unanswered_count": 0,
"commented_questions_count": 0,
"comments_count": 0,
"total_bonus": 0
}

Create An Attempt

This endpoint will create a new attempt for the exam.

HTTP Request

POST /api/v2.2/exams/<exam_slug>/attempts/

URL Parameters

ParameterDescription
exam_slugThe unique slug of the exam for which the attempt should be created
curl --request POST \
--url http://demo.testpress.in/api/v2.2/exams/dummy-test-7-8/attempts/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"url": "http://demo.testpress.in/api/v2.2/attempts/400/",
"id": 400,
"exam_url": "http://demo.testpress.in/api/v2.2/exams/dummy-test-7-8/",
"user": {
"id": 5,
"url": "http://demo.testpress.in/api/v2.2/users/5/",
"username": "demouser",
"display_name": "DemoUser is my name eeeeee123456789012345678901234",
"first_name": "DemoUser is my name eeeeee123456789012345678901234",
"last_name": "",
"photo": "https://media.testpress.in/i/bc194c3b0f3241ad9473edf949de3cec.jpeg",
"large_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/459b2af2355549dc8d7f411553128903.jpeg",
"medium_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/05c3efc7e4e3454ebad1c32c0c69297c.jpeg",
"medium_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/ca7ae15e26cc4586ae5f98750c2acc62.jpeg",
"small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/33936fd431e14a9ab54d7e24e70bf301.jpeg",
"x_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/673ceb6e18b343318fba39279ef07594.jpeg",
"mini_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/3214f5359ad247d1b2e38609376af72b.jpeg"
},
"date": "2017-05-24T07:32:09.891Z",
"total_questions": 50,
"score": 0,
"review_pdf_url": "",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/400/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/400/questions/",
"percentile": 0,
"correct_count": 0,
"incorrect_count": 0,
"last_started_time": "2017-05-24T07:32:09.921Z",
"remaining_time": "1:59:59",
"time_taken": "0:00:01",
"state": "Running",
"rank": "NA",
"max_rank": "NA",
"percentage": "0",
"unanswered_count": 0,
"commented_questions_count": 0,
"comments_count": 0,
"total_bonus": 0,
"rank_enabled": false,
"exam": {
"url": "http://demo.testpress.in/api/v2.2/exams/dummy-test-7-8/",
"id": 31,
"title": "Dummy Test 7",
"description": "",
"start_date": "2017-03-30T18:58:53+07:00",
"end_date": null,
"duration": "2:00:00",
"number_of_questions": 50,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 1,
"allow_retake": true,
"max_retakes": -1,
"enable_ranks": false,
"rank_publishing_date": null,
"allow_pdf": false,
"allow_question_pdf": false,
"created": "2017-03-30T13:29:05.007Z",
"slug": "dummy-test-7-8",
"variable_mark_per_question": false,
"show_answers": true,
"allow_preemptive_section_ending": false,
"sections": [
{
"order": 0,
"name": "",
"duration": "2:00:00",
"cut_off": 0
}
],
"immediate_feedback": false,
"categories": []
},
"sections": [],
"speed": 0,
"accuracy": 0,
"institute_attempt_id": null
}

This endpoint will create a new attempt for the exam.

HTTP Request

POST /api/v2.2/exams/<exam_slug>/attempts/

URL Parameter

ParameterDescription
exam_slugThe unique slug of the exam for which the attempt should be created

Resume An Attempt

This endpoint starts a paused attempt. This is for restarting the timer calculation incase of a paused attempt.

info

It is best practice to always call this API when trying to resume a paused exam. If not done, the server might end the exam as time over if the time elapsed exceeds the assigned time for the exam.

HTTP Request

PUT /api/v2.2/attempts/<id>/start/

URL Parameters

ParameterDescription
idThe unique id of the attempt to retrieve
curl --request PUT \
--url http://demo.testpress.in/api/v2.2/attempts/125894/start/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"url": "http://demo.testpress.in/api/v2.2/attempts/125894/",
"id": 125894,
"exam": {
"url": "http://demo.testpress.in/api/v2.2/exams/forum-ias-rbi-demo/",
"id": 3720,
"title": "FORUM IAS RBI DEMO",
"description": "",
"course": "TNPSC",
"start_date": "2.25-11-07T12:37:11+05:30",
"end_date": "2.25-11-15T12:37:11+05:30",
"duration": "3:00:00",
"number_of_questions": 200,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 2,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"allow_pdf": false,
"created": "2.25-11-07T07:07:41.597Z",
"slug": "forum-ias-rbi-demo",
"variable_mark_per_question": false,
"show_answers": true
},
"user": "testpress",
"date": "2.25-11-07T07:12:49.873Z",
"total_questions": 200,
"score": "0.00",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/125894/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/125894/questions/",
"percentile": 0,
"correct_count": 0,
"incorrect_count": 0,
"last_started_time": "2.25-11-18T09:50:20.287Z",
"remaining_time": "2.20:03",
"time_taken": "0:49:57",
"state": "Running",
"rank": "NA",
"max_rank": 0,
"percentage": "0",
"unanswered_count": 0,
"commented_questions_count": 0,
"comments_count": 0,
"total_bonus": 0
}

Send Heart Beat

For every minute, this API should be called during the attempt window. This is done to update the remaining time for that attempt in the server.

HTTP Request

PUT /api/v2.2/attempts/<id>/heartbeat/

ParameterDescription
idThe unique id of the attempt to update
curl --request PUT \
--url http://demo.testpress.in/api/v2.2/attempts/400/heartbeat/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"url": "http://demo.testpress.in/api/v2.2/attempts/400/",
"id": 400,
"exam_url": "http://demo.testpress.in/api/v2.2/exams/dummy-test-7-8/",
"user": {
"id": 5,
"url": "http://demo.testpress.in/api/v2.2/users/5/",
"username": "demouser",
"display_name": "DemoUser is my name eeeeee123456789012345678901234",
"first_name": "DemoUser is my name eeeeee123456789012345678901234",
"last_name": "",
"photo": "https://media.testpress.in/i/bc194c3b0f3241ad9473edf949de3cec.jpeg",
"large_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/459b2af2355549dc8d7f411553128903.jpeg",
"medium_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/05c3efc7e4e3454ebad1c32c0c69297c.jpeg",
"medium_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/ca7ae15e26cc4586ae5f98750c2acc62.jpeg",
"small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/33936fd431e14a9ab54d7e24e70bf301.jpeg",
"x_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/673ceb6e18b343318fba39279ef07594.jpeg",
"mini_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/3214f5359ad247d1b2e38609376af72b.jpeg"
},
"date": "2017-05-24T07:32:09.891Z",
"total_questions": 50,
"score": "0.00",
"review_pdf_url": "",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/400/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/400/questions/",
"percentile": 0,
"correct_count": 0,
"incorrect_count": 0,
"last_started_time": "2017-05-24T07:37:10.655Z",
"remaining_time": "1:54:59",
"time_taken": "0:05:01",
"state": "Running",
"rank": "NA",
"max_rank": "NA",
"percentage": "0",
"unanswered_count": 0,
"commented_questions_count": 0,
"comments_count": 0,
"total_bonus": 0,
"rank_enabled": false,
"exam": {
"url": "http://demo.testpress.in/api/v2.2/exams/dummy-test-7-8/",
"id": 31,
"title": "Dummy Test 7",
"description": "",
"start_date": "2017-03-30T18:58:53+07:00",
"end_date": null,
"duration": "2:00:00",
"number_of_questions": 50,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 1,
"allow_retake": true,
"max_retakes": -1,
"enable_ranks": false,
"rank_publishing_date": null,
"allow_pdf": false,
"allow_question_pdf": false,
"created": "2017-03-30T13:29:05.007Z",
"slug": "dummy-test-7-8",
"variable_mark_per_question": false,
"show_answers": true,
"allow_preemptive_section_ending": false,
"sections": [
{
"order": 0,
"name": "",
"duration": "2:00:00",
"cut_off": 0
}
],
"immediate_feedback": false,
"categories": []
},
"sections": [],
"speed": 0,
"accuracy": 0,
"institute_attempt_id": null
}

End An Attempt

This endpoint ends an attempt. The state of the attempt will return as Completed. An attempt which has been ended cannot be started again using the /start/ end point

info

One cannot review an attempt if this API is not called.

HTTP Request

PUT /api/v2.2/attempts/<id>/end/

URL Parameters

ParameterDescription
idThe unique id of the attempt to end
curl --request PUT \
--url http://demo.testpress.in/api/v2.2/attempts/125894/end/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"url": "http://demo.testpress.in/api/v2.2/attempts/125894/",
"id": 125894,
"exam": {
"url": "http://demo.testpress.in/api/v2.2/exams/forum-ias-rbi-demo/",
"id": 3720,
"title": "FORUM IAS RBI DEMO",
"description": "",
"course": "TNPSC",
"start_date": "2.25-11-07T12:37:11+05:30",
"end_date": "2.25-11-15T12:37:11+05:30",
"duration": "3:00:00",
"number_of_questions": 200,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 2,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"allow_pdf": false,
"created": "2.25-11-07T07:07:41.597Z",
"slug": "forum-ias-rbi-demo",
"variable_mark_per_question": false,
"show_answers": true
},
"user": "testpress",
"date": "2.25-11-07T07:12:49.873Z",
"total_questions": 200,
"score": "2.00",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/125894/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/125894/questions/",
"percentile": 100,
"correct_count": 2,
"incorrect_count": 6,
"last_started_time": "2.25-11-18T09:50:20.287Z",
"remaining_time": "2.20:03",
"time_taken": "0:49:57",
"state": "Completed",
"rank": "NA",
"max_rank": 0,
"percentage": "1",
"unanswered_count": 192,
"commented_questions_count": 0,
"comments_count": 0,
"total_bonus": 0
}

Get Attempt Questions

This endpoint returns all questions for an attempt.

caution

This will fail if the attempt is in Completed state.

HTTP Request

PUT /api/v2.2/attempts/<id>/questions/

URL Parameters

ParameterDescription
idThe unique id of the attempt to retrieve
curl --request GET \
--url http://demo.testpress.in/api/v2.2/attempts/122046/questions/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 100,
"next": "http://demo.testpress.in/api/v2.2/attempts/122046/questions/?page=2",
"previous": null,
"per_page": 20,
"results": [
{
"id": 12705318,
"url": "http://demo.testpress.in/api/v2.2/attempts/122046/questions/12705318/",
"question": {
"question_html": "<p>Which of the following is/are the principal feature (s) of the Government of India Act, 1919? <br>\n1. Introduction of dyarchy in the executive government of the provinces<br>\n2. Introduction of separate communal electorates for Muslims<br>\n3. Devolution of legislative authority by the centre to the provinces</p><p>Select the correct answer using the codes given below:</p><p><img src=\"https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/ebd87eb5c09b445d879610586fca072e.png\"></p>",
"direction": null,
"answers": [
{
"text_html": "<p>1 only</p>",
"id": 129
},
{
"text_html": "<p>2 and 3 only</p>",
"id": 130
},
{
"text_html": "<p>1 and 3 only</p>",
"id": 131
},
{
"text_html": "<p>1, 2 and 3</p>",
"id": 132
}
],
"essay_topics": [],
"subject": "khecha subject",
"type": "C"
},
"duration": null,
"selected_answers": [],
"essay_text": null,
"essay_topic": null,
"review": null
},
{
"id": 12705296,
"url": "http://demo.testpress.in/api/v2.2/attempts/122046/questions/12705296/",
"question": {
"question_html": "<p>With reference to National Rural Health Mission, which of the following are the jobs of ASHA, a trained community health worker?</p>\n<p>1.Accompanying women to the health facility for antenatal care checkup</p>\n<p>2.Using pregnancy test kits for early detection of pregnancy </p>\n<p>3.Providing information on nutrition and immunization</p>\n<p>4.Conducting the delivery of baby</p>\n<p>Select the correct answer using the codes given below:</p>",
"direction": null,
"answers": [
{
"text_html": "<p>1, 2 and 3 Only</p>",
"id": 413
},
{
"text_html": "<p>2 and 4 Only</p>",
"id": 414
},
{
"text_html": "<p>1 and 3 Only</p>",
"id": 415
},
{
"text_html": "<p>1, 2, 3 and 4</p>",
"id": 416
}
],
"essay_topics": [],
"subject": "Sin Questions",
"type": "R"
},
"duration": null,
"selected_answers": [],
"essay_text": null,
"essay_topic": null,
"review": null
}
]
}

Update Attempt Questions

This endpoint will update a question with the selected_answers and review.

caution

This will fail if the attempt is in Completed state.

HTTP Request

PUT /api/v2.2/attempts/<id>/questions/<question_id>

URL Parameters

ParameterDescription
idThe unique id of the attempt
question_idThe unique id of the attempt question
curl --request PUT \
--url http://demo.testpress.in/api/v2.2/attempts/122046/questions/12705318/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{\n"selected_answers": [129, 130],\n"review": true\n}'

Response

{
"id": 12705318,
"url": "http://demo.testpress.in/api/v2.2/attempts/122046/questions/12705318/",
"question": {
"question_html": "<p>Which of the following is/are the principal feature (s) of the Government of India Act, 1919? <br>\n1. Introduction of dyarchy in the executive government of the provinces<br>\n2. Introduction of separate communal electorates for Muslims<br>\n3. Devolution of legislative authority by the centre to the provinces</p><p>Select the correct answer using the codes given below:</p><p><img src=\"https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/ebd87eb5c09b445d879610586fca072e.png\"></p>",
"direction": null,
"answers": [
{
"text_html": "<p>1 only</p>",
"id": 129
},
{
"text_html": "<p>2 and 3 only</p>",
"id": 130
},
{
"text_html": "<p>1 and 3 only</p>",
"id": 131
},
{
"text_html": "<p>1, 2 and 3</p>",
"id": 132
}
],
"essay_topics": [],
"subject": "khecha subject",
"type": "C"
},
"duration": "20 days, 3:58:48.044696",
"selected_answers": [
129,
130
],
"essay_text": null,
"essay_topic": null,
"review": true
}

Review Attempt Questions

This endpoint returns all questions for an attempt with correct answer & explanation.

caution

This API will work only if the attempt is in Completed state.

HTTP Request

GET /api/v2.2/attempts/<id>/review/

URL Parameters

ParameterDescription
idThe unique id of the attempt for which the questions should be retrieved
curl --request GET \
--url http://demo.testpress.in/api/v2.2/attempts/122046/review/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"id": 52,
"url": "http://demo.testpress.in/api/v2.2/attempts/12/review/52/",
"order": 0,
"question": {
"id": 2,
"url": "http://demo.testpress.in/api/v2.2/questions/2/",
"question_html": "<p>Pick similar things</p>\n",
"direction": null,
"answers": [
{
"id": 3,
"text_html": "<p>ComputerComputer</p>\n",
"is_correct": true
},
{
"id": 4,
"text_html": "<p>Mouse Mouse Mouse</p>\n",
"is_correct": true
},
{
"id": 5,
"text_html": "<p>Table</p>\n",
"is_correct": false
},
{
"id": 6,
"text_html": "<p>CPU</p>\n",
"is_correct": true
}
],
"essay_topics": [],
"subject": "General Knowledge",
"explanation_html": "",
"type": "C",
"comments_url": "http://demo.testpress.in/api/v2.2/questions/2/comments/",
"marks": "1.00",
"negative_marks": "0.00"
},
"duration": "NA",
"best_duration": 0.61,
"average_duration": 17.31,
"selected_answers": [],
"essay_text": null,
"essay_topic": null,
"review": null,
"comments_count": 0,
"correct_percentage": 25
},
{
"id": 53,
"url": "http://demo.testpress.in/api/v2.2/attempts/12/review/53/",
"order": 0,
"question": {
"id": 3,
"url": "http://demo.testpress.in/api/v2.2/questions/3/",
"question_html": "<p>Odd one out</p>\n",
"direction": null,
"answers": [
{
"id": 7,
"text_html": "<p>Table Table Table</p>\n",
"is_correct": false
},
{
"id": 8,
"text_html": "<p>TreeTreeTree</p>\n",
"is_correct": true
},
{
"id": 9,
"text_html": "<p>Book</p>\n",
"is_correct": false
},
{
"id": 10,
"text_html": "<p>Water Bottle</p>\n",
"is_correct": false
}
],
"essay_topics": [],
"subject": "General Knowledge",
"explanation_html": "",
"type": "R",
"comments_url": "http://demo.testpress.in/api/v2.2/questions/3/comments/",
"marks": "1.00",
"negative_marks": "0.00"
},
"duration": 1,
"best_duration": 0.67,
"average_duration": 11.3,
"selected_answers": [
8
],
"essay_text": null,
"essay_topic": null,
"review": false,
"comments_count": 0,
"correct_percentage": 16
}
]
}

Attempt Subject Wise Analytics

This endpoint returns subject wise analytics of the attempt.

caution

This API will work only if the attempt is in Completed state.

HTTP Request

GET /api/v2.2/attempts/<id>/review/subjects/

URL Parameters

ParameterDescription
idThe unique id of the attempt for which analytics should be retrieved
curl --request GET \
--url http://demo.testpress.in/api/v2.2/attempts/377/review/subjects/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 6,
"next": null,
"previous": null,
"per_page": 200,
"results": [
{
"id": 20,
"name": "PSM",
"total": 2,
"correct": 0,
"unanswered": 0,
"incorrect": 2,
"parent": null,
"leaf": true,
"score": "-2.00"
},
{
"id": 17,
"name": "Microbiology",
"total": 1,
"correct": 1,
"unanswered": 0,
"incorrect": 0,
"parent": null,
"leaf": true,
"score": "4.00"
}
]
}

- + \ No newline at end of file diff --git a/docs/server-api/students-apis/basic-example/index.html b/docs/server-api/students-apis/basic-example/index.html index de16461..486b903 100644 --- a/docs/server-api/students-apis/basic-example/index.html +++ b/docs/server-api/students-apis/basic-example/index.html @@ -4,13 +4,13 @@ Basic Example | Testpress docs - +

Basic Example

Following is a basic example of test taking flow

  1. Get the Auth token to authenticate the user using the Get Auth Token API.
  2. Use the token as Authorization header in the following requests.
  3. Now try to get list of exams using the Get Available Exams API.
  4. Get exam details of an exam in the list of exams using the Get Exam Details API.
  5. Start a new attempt for the exam using the Create an attempt API.
  6. Using the response of the new attempt, get the questions for that attempt using the Get attempt questions API.
  7. Attend the questions by updating the selected answers or review later flag using Update attempt questions API.
  8. Send heart beat every 1 minute using Send Heart Beat API.
  9. End the attempt once all the required questions have been attempted.
  10. Review the solutions of the completed attempt using Get Review Questions API.
  11. Review the subject wise analytics of the completed attempt using Get Attempt Subject Wise Analytics API.
- + \ No newline at end of file diff --git a/docs/server-api/students-apis/exams/index.html b/docs/server-api/students-apis/exams/index.html index 2928b3c..0b97d24 100644 --- a/docs/server-api/students-apis/exams/index.html +++ b/docs/server-api/students-apis/exams/index.html @@ -4,13 +4,13 @@ Exams | Testpress docs - +

Exams

Exams API gives you access to read all the exams which can be accessed by the authenticated user.

Get All Exams

This endpoint retrieves all exams for the authenticated user.

HTTP Request

GET /api/v2.2/exams/

Query Parameters

ParameterTypeDescription
coursestringFilters by course name. Ex: IBPS
statestringIndicates state of the exams to return. Can be one of: available, upcoming, history
qstringFilters by exam title. Useful to search by exam title.
curl --request GET \
--url http://demo.testpress.in/api/v2.2/exams/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwidXNlcl9pZCI6MTAsImVtYWlsIjoiYmhhcmF0aEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NDc4Mjk5Nzl9.a_LVMuVyMcNQ7Qlu3w7icUYAQa9Mv2jhYikih4r-Wn8' \
--header 'cache-control: no-cache'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/",
"id": 2394,
"title": "Aptitude Analytical Maths (NBE Template)",
"description": "",
"course": "Uncategorized",
"start_date": "2.23-08-02.27:25:22+05:30",
"end_date": "2.29-08-01T17:25:22+05:30",
"duration": "0:30:30",
"number_of_questions": 20,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 4,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"attempts_url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/attempts/",
"allow_pdf": true,
"created": "2.25-04-09T00:00:00Z",
"slug": "aptitude-analytical-maths-nbe-template-15",
"variable_mark_per_question": false,
"show_answers": true,
"comments_count": 0
},
{
"url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-16/",
"id": 2395,
"title": "Aptitude Analytical Maths (NBE Template)",
"description": "",
"course": "Uncategorized",
"start_date": "2.23-08-02.27:25:22+05:30",
"end_date": "2.29-08-01T17:25:22+05:30",
"duration": "0:30:30",
"number_of_questions": 20,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 4,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"attempts_url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-16/attempts/",
"allow_pdf": true,
"created": "2.25-04-09T00:00:00Z",
"slug": "aptitude-analytical-maths-nbe-template-16",
"variable_mark_per_question": false,
"show_answers": true,
"comments_count": 0
}
]
}

Get A Single Exam

This endpoint retrieves a single exam.

Note that some exams will return 403 Forbidden if they are not available for the authenticated user.

HTTP Request

GET /api/v2.2/exams/<slug>

URL Parameters

ParameterDescription
slugThe unique slug of the exam to retrieve
curl --request GET \
--url http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/",
"id": 2394,
"title": "Aptitude Analytical Maths (NBE Template)",
"description": "",
"course": "Uncategorized",
"start_date": "2.23-08-02.27:25:22+05:30",
"end_date": "2.29-08-01T17:25:22+05:30",
"duration": "0:30:30",
"number_of_questions": 20,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 4,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"attempts_url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/attempts/",
"attempts": [
{
"url": "http://demo.testpress.in/api/v2.2/attempts/59591/",
"id": 59591,
"user": "testpress",
"date": "2.25-07-14T05:16:12.086Z",
"total_questions": 20,
"score": "2.00",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/59591/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/59591/questions/",
"percentile": 80,
"correct_count": 2,
"incorrect_count": 6,
"last_started_time": "2.25-07-14T05:20:36.851Z",
"remaining_time": "0:29:52",
"time_taken": "0:00:38",
"state": "Completed",
"rank": "NA",
"max_rank": 0,
"percentage": "10",
"unanswered_count": 12
},
{
"url": "http://demo.testpress.in/api/v2.2/attempts/59312/",
"id": 59312,
"user": "testpress",
"date": "2.25-07-13T05:07:54.639Z",
"total_questions": 20,
"score": "0.00",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/59312/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/59312/questions/",
"percentile": 40,
"correct_count": 0,
"incorrect_count": 0,
"last_started_time": "2.25-07-13T05:07:54.666Z",
"remaining_time": "0:30:29",
"time_taken": "0:00:01",
"state": "Completed",
"rank": "NA",
"max_rank": 0,
"percentage": "0",
"unanswered_count": 20
},
{
"url": "http://demo.testpress.in/api/v2.2/attempts/33827/",
"id": 33827,
"user": "testpress",
"date": "2.25-05-13T13:03:53.339Z",
"total_questions": 20,
"score": "0.00",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/33827/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/33827/questions/",
"percentile": 40,
"correct_count": 0,
"incorrect_count": 1,
"last_started_time": "2.25-05-14T05:24:47.437Z",
"remaining_time": "0:30:29",
"time_taken": "0:00:01",
"state": "Completed",
"rank": "NA",
"max_rank": 0,
"percentage": "0",
"unanswered_count": 19
},
{
"url": "http://demo.testpress.in/api/v2.2/attempts/31823/",
"id": 31823,
"user": "testpress",
"date": "2.25-04-21T04:47:26.454Z",
"total_questions": 20,
"score": "0.00",
"review_url": "http://demo.testpress.in/api/v2.2/attempts/31823/review/",
"questions_url": "http://demo.testpress.in/api/v2.2/attempts/31823/questions/",
"percentile": 40,
"correct_count": 0,
"incorrect_count": 2,
"last_started_time": "2.25-05-05T05:34:40.640Z",
"remaining_time": "0:30:23",
"time_taken": "0:00:07",
"state": "Completed",
"rank": "NA",
"max_rank": 0,
"percentage": "0",
"unanswered_count": 18
}
],
"allow_pdf": true,
"created": "2.25-04-09T00:00:00Z",
"slug": "aptitude-analytical-maths-nbe-template-15",
"variable_mark_per_question": false,
"show_answers": true,
"comments_count": 0
}

Get Available Exams

This endpoint retrieves all available and unattempted exams for the authenticated user. This is same as getting all exams with state query parameter as available.

HTTP Request

GET /api/v2.2/exams/available/

Query Parameters

ParameterTypeDescription
coursestringFilters by course name. Ex: IBPS
statestringIndicates state of the exams to return. Can be one of: available, upcoming, history
qstringFilters by exam title. Useful to search by exam title.
curl --request GET \
--url http://demo.testpress.in/api/v2.2/exams/available/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/",
"id": 2394,
"title": "Aptitude Analytical Maths (NBE Template)",
"description": "",
"course": "Uncategorized",
"start_date": "2.23-08-02.27:25:22+05:30",
"end_date": "2.29-08-01T17:25:22+05:30",
"duration": "0:30:30",
"number_of_questions": 20,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 4,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"attempts_url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/attempts/",
"allow_pdf": true,
"created": "2.25-04-09T00:00:00Z",
"slug": "aptitude-analytical-maths-nbe-template-15",
"variable_mark_per_question": false,
"show_answers": true,
"comments_count": 0
},
{
"url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-16/",
"id": 2395,
"title": "Aptitude Analytical Maths (NBE Template)",
"description": "",
"course": "Uncategorized",
"start_date": "2.23-08-02.27:25:22+05:30",
"end_date": "2.29-08-01T17:25:22+05:30",
"duration": "0:30:30",
"number_of_questions": 20,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 4,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"attempts_url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-16/attempts/",
"allow_pdf": true,
"created": "2.25-04-09T00:00:00Z",
"slug": "aptitude-analytical-maths-nbe-template-16",
"variable_mark_per_question": false,
"show_answers": true,
"comments_count": 0
}
]
}

Get Upcoming Exams

This endpoint retrieves all upcoming exams for the authenticated user. This is same as getting all exams with state query parameter as upcoming.

HTTP Request

GET /api/v2.2/exams/upcoming/

Query Parameters

ParameterTypeDescription
coursestringFilters by course name. Ex: IBPS
qstringFilters by exam title. Useful to search by exam title.
curl --request GET \
--url http://demo.testpress.in/api/v2.2/exams/upcoming/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/",
"id": 2394,
"title": "Aptitude Analytical Maths (NBE Template)",
"description": "",
"course": "Uncategorized",
"start_date": "2.23-08-02.27:25:22+05:30",
"end_date": "2.29-08-01T17:25:22+05:30",
"duration": "0:30:30",
"number_of_questions": 20,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 4,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"attempts_url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/attempts/",
"allow_pdf": true,
"created": "2.25-04-09T00:00:00Z",
"slug": "aptitude-analytical-maths-nbe-template-15",
"variable_mark_per_question": false,
"show_answers": true,
"comments_count": 0
},
{
"url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-16/",
"id": 2395,
"title": "Aptitude Analytical Maths (NBE Template)",
"description": "",
"course": "Uncategorized",
"start_date": "2.23-08-02.27:25:22+05:30",
"end_date": "2.29-08-01T17:25:22+05:30",
"duration": "0:30:30",
"number_of_questions": 20,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 4,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"attempts_url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-16/attempts/",
"allow_pdf": true,
"created": "2.25-04-09T00:00:00Z",
"slug": "aptitude-analytical-maths-nbe-template-16",
"variable_mark_per_question": false,
"show_answers": true,
"comments_count": 0
}
]
}

Get History Of Exams

This endpoint retrieves all history exams for the authenticated user. This is same as getting all exams with state query parameter as history.

HTTP Request

GET /api/v2.2/exams/history/

Query Parameters

ParameterTypeDescription
coursestringFilters by course name. Ex: IBPS
statestringIndicates state of the exams to return. Can be one of: available, upcoming, history
qstringFilters by exam title. Useful to search by exam title.
curl --request GET \
--url http://demo.testpress.in/api/v2.2/exams/history/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/",
"id": 2394,
"title": "Aptitude Analytical Maths (NBE Template)",
"description": "",
"course": "Uncategorized",
"start_date": "2.23-08-02.27:25:22+05:30",
"end_date": "2.29-08-01T17:25:22+05:30",
"duration": "0:30:30",
"number_of_questions": 20,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 4,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"attempts_url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-15/attempts/",
"allow_pdf": true,
"created": "2.25-04-09T00:00:00Z",
"slug": "aptitude-analytical-maths-nbe-template-15",
"variable_mark_per_question": false,
"show_answers": true,
"comments_count": 0
},
{
"url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-16/",
"id": 2395,
"title": "Aptitude Analytical Maths (NBE Template)",
"description": "",
"course": "Uncategorized",
"start_date": "2.23-08-02.27:25:22+05:30",
"end_date": "2.29-08-01T17:25:22+05:30",
"duration": "0:30:30",
"number_of_questions": 20,
"negative_marks": "0.00",
"mark_per_question": "1.00",
"template_type": 4,
"allow_retake": true,
"max_retakes": null,
"enable_ranks": false,
"rank_publishing_date": null,
"attempts_url": "http://demo.testpress.in/api/v2.2/exams/aptitude-analytical-maths-nbe-template-16/attempts/",
"allow_pdf": true,
"created": "2.25-04-09T00:00:00Z",
"slug": "aptitude-analytical-maths-nbe-template-16",
"variable_mark_per_question": false,
"show_answers": true,
"comments_count": 0
}
]
}
- + \ No newline at end of file diff --git a/docs/server-api/students-apis/posts/index.html b/docs/server-api/students-apis/posts/index.html index af1a31c..765002f 100644 --- a/docs/server-api/students-apis/posts/index.html +++ b/docs/server-api/students-apis/posts/index.html @@ -4,13 +4,13 @@ Posts | Testpress docs - +

Posts

Posts are broadcast data which the institutes want to share to their users. This endpoint can be used to retrieve the posts which are accessible to a particular user.

Get All Posts

This endpoint retrieves all posts for the authenticated user.

HTTP Request

GET /api/v2.2/posts/

Query Parameters

ParameterTypeDescription
gtdatestringFilter posts created greater than the date
itdatestringFilter posts created lesser than the date
orderstringOrder posts based on the field queried. For descending order, prefix with '-'
categorystringFilter posts based on category
curl --request GET \
--url http://demo.testpress.in/api/v2.2/posts/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json'

Response

{
"count": 2,
"next": "http://demo.testpress.in/api/v2.2/posts/?page=2",
"previous": null,
"per_page": 20,
"results": [
{
"url": "http://demo.testpress.in/api/v2.2/posts/post-title2/",
"created_by": {
"id": 10,
"url": "http://demo.testpress.in/api/v2.2/users/10/",
"username": "admin",
"display_name": "admin",
"first_name": "",
"last_name": "",
"photo": "",
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": ""
},
"category": {
"id": 2,
"name": "Daliy News",
"color": "33CC33",
"slug": "daliy-news"
},
"created": "2.25-10-15T15:24:34Z",
"modified": "2.25-10-15T15:24:34Z",
"id": 33,
"active": true,
"title": "Post Title2",
"summary": "summary goes here",
"institute": 1
},
{
"url": "http://demo.testpress.in/api/v2.2/posts/working-great/",
"created_by": {
"id": 10,
"url": "http://demo.testpress.in/api/v2.2/users/10/",
"username": "admin",
"display_name": "admin",
"first_name": "",
"last_name": "",
"photo": "",
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": ""
},
"category": {
"id": 2,
"name": "Daliy News",
"color": "33CC33",
"slug": "daliy-news"
},
"created": "2.25-10-07T06:00:07Z",
"modified": "2.25-10-07T06:00:07Z",
"id": 26,
"active": true,
"title": "Working Great",
"summary": "All is Well",
"institute": 1
}
]
}

Get Single Post

This endpoint retrieves a single post.

Note that some posts will return 403 Forbidden if they are not available for the authenticated user.

HTTP Request

GET /api/v2.2/posts/<slug>

URL Parameters

ParameterDescription
slugThe unique slug of the post to retrieve
curl --request GET \
--url http://demo.testpress.in/api/v2.2/posts/working-great/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json'

Response

{
"url": "http://demo.testpress.in/api/v2.2/posts/working-great/",
"created_by": {
"id": 10,
"url": "http://demo.testpress.in/api/v2.2/users/10/",
"username": "admin",
"display_name": "admin",
"first_name": "",
"last_name": "",
"photo": "",
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": ""
},
"category": {
"id": 2,
"name": "Daliy News",
"color": "33CC33",
"slug": "daliy-news"
},
"created": "2.25-10-07T06:00:07Z",
"modified": "2.25-10-07T06:00:07Z",
"id": 26,
"active": true,
"title": "Working Great",
"summary": "All is Well",
"content_html": "<p>Good Better Best</p>",
"institute": 1
}
- + \ No newline at end of file diff --git a/docs/server-api/students-apis/products/index.html b/docs/server-api/students-apis/products/index.html index 38875bf..0da7222 100644 --- a/docs/server-api/students-apis/products/index.html +++ b/docs/server-api/students-apis/products/index.html @@ -4,13 +4,13 @@ Products | Testpress docs - +

Products

Products API gives you access to read all the products which are active and can be purchased.

Get All Products

This endpoint retrieves all products available for purchase in an institute.

HTTP Request

GET /api/v2.2/products/

Query Parameters

ParameterTypeDescription
categorystringFilters by category name. Ex: IBPS

Fields

NameTypeDescription
idintThe product unique ID
urlstringURL to get details of the product
titlestringTitle of the product
slugstringHuman readable keyword string of the product
imagesarrayAn array of image urls for the product
- original - User uploaded size
- medium - 300x250px
- small - 100x83px
start_datedatestringStart date of product
end_datedatestringEnd date of product
categoriesarrayCategories to which this product belongs
typesarrayType of goods included in this package. Can be E-books, Exams, Classroom Program, Books
pricestringPrice of the product in INR
exams_countintNumber of exams present in this product
notes_countintNumber of documents present in this product
curl --request GET \
--url http://demo.testpress.in/api/v2.2/products/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 1,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"id": 243,
"url": "http://demo.testpress.in/api/v2.2/products/free-ias-prelims-power-pack/",
"title": "Free IAS Prelims Power Pack",
"slug": "free-ias-prelims-power-pack",
"image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/770056a05ab2433191eeeef8de75210f.png",
"images": [
{
"original": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/770056a05ab2433191eeeef8de75210f.png",
"medium": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/bfbfcf2f31f84c5aada30eba2ae6bd2e.png",
"small": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/63b181a83d8c4e198309cacb110bac35.png"
}
],
"start_date": "2.25-01-01T00:00:00+05:30",
"end_date": "2021-12-31T00:00:00+05:30",
"categories": [
"TNPSC"
],
"types": [
"E-books",
"Exams"
],
"exams_count": 1,
"notes_count": 0,
"price": "1.00"
}
]
}

Get Single Product

This endpoint retrieves all products available for purchase in an institute.

HTTP Request

GET /api/v2.2/products/<slug>

URL Parameters

ParameterDescription
slugThe unique slug of the product to retrieve

Fields

NameTypeDescription
descriptionstringBrief description of the product
examsarrayExams present in this product
notesarrayDocuments present in this product
requires_shippingbooleanWhether the product has shippable goods
curl --request GET \
--url http://demo.testpress.in/api/v2.2/products/free-ias-prelims-power-pack/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 1,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"id": 243,
"url": "http://demo.testpress.in/api/v2.2/products/free-ias-prelims-power-pack/",
"title": "Free IAS Prelims Power Pack",
"slug": "free-ias-prelims-power-pack",
"image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/770056a05ab2433191eeeef8de75210f.png",
"images": [
{
"original": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/770056a05ab2433191eeeef8de75210f.png",
"medium": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/bfbfcf2f31f84c5aada30eba2ae6bd2e.png",
"small": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/63b181a83d8c4e198309cacb110bac35.png"
}
],
"start_date": "2.25-01-01T00:00:00+05:30",
"end_date": "2021-12-31T00:00:00+05:30",
"categories": [
"TNPSC"
],
"types": [
"E-books",
"Exams"
],
"exams_count": 1,
"notes_count": 0,
"price": "1.00"
}
]
}
- + \ No newline at end of file diff --git a/docs/server-api/students-apis/users/index.html b/docs/server-api/students-apis/users/index.html index b3d5d03..fd025a0 100644 --- a/docs/server-api/students-apis/users/index.html +++ b/docs/server-api/students-apis/users/index.html @@ -4,13 +4,13 @@ Users | Testpress docs - +

Users

Users API gives you access to get basic information about other users present in the institute.

This endpoint protects the privacy of users. It is NOT possible to extra personal details of all the users from this endpoint. An admin however can extract the personal details using the Admin APIs.

Get Current authenticated user

This endpoint retrieves details of the authenticated user.

HTTP Request

GET /api/v2.2/me/

Fields

NameTypeDescription
idintThe user unique ID
batchesarrayList of batches to which this user belongs
urlstringURL to get details of the user
usernamestringUsername of the user
first_namestringFirst name of the user
last_namestringLast name of the user
display_namestringDisplay name of the user (Concatenates first_name & last_name if available. Falls back to username)
emailstringEmail of the user
photostringOriginal photo uploaded by the user
large_imagestringProfile photo transformed to 256x256 px
medium_imagestringProfile photo transformed to 128x128 px
small_imagestringProfile photo transformed to 48x48 px
x_small_imagestringProfile photo transformed to 32x32 px
mini_imagestringProfile photo transformed to 24x24 px
birth_datedatestringBirth date as provided by the user
genderstringGender as provided by the user. Can be "Male", "Female" or "Transgender"
address1stringAddress provided by the user
address2stringAddress provided by the user
citystringCity provided by the user
zipstringPincode provided by the user
statestringState provided by the user
phonestringPhone provided by the user
curl --request GET \
--url http://demo.testpress.in/api/v2.2/me/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"id": 17,
"batches": [
"EEE",
"ECE",
"Unique UPSC Batch",
"POZITIVE ONLINE TEST SERIES",
"OHC 2.23",
"st std A",
"IBPS Morning Batch",
"UPSC Morning Batch",
"NEET Morning Batch",
"IBPS Online Batch",
"UPSC Evening Batch"
],
"url": "http://demo.testpress.in/api/v2.2/users/17/",
"username": "testpress",
"display_name": "Divya",
"first_name": "Divya",
"last_name": "",
"email": "testpress.in@gmail.com",
"photo": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/9b69ab73fc924813871b2ef1e2ef00fa.jpeg",
"large_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/493054067d1d4173a22d96b824d7f0c6.jpeg",
"medium_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/8d96dab06a82487ab3149b771fe5d479.jpeg",
"small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/4023a394cd36472fa24db76e493192ce.jpeg",
"x_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/796fa9a9727a42e4a7faa015b0388af3.jpeg",
"mini_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/5f9215132af54acc8e72aed968582763.jpeg",
"birth_date": "1994-08-27",
"gender": "Female",
"address1": "Chennai",
"address2": "Chennai",
"city": "Chennai",
"zip": "600069",
"state": "Tamil Nadu",
"phone": "9043570576"
}

Get a single user

This endpoint retrieves publicly available details of a single user.

This endpoint protects the privacy of users. If the requested user is same as authenticated user, then the response will be same as /api/v2.2/me/. Otherwise, personal contact details will not be available.

HTTP Request

GET /api/v2.2/users/{id}

URL Parameters

ParameterDescription
idThe unique id of the user to retrieve

curl --request GET \
--url http://demo.testpress.in/api/v2.2/users/18/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response


{
"id": 18,
"url": "http://demo.testpress.in/api/v2.2/users/18/",
"username": "Vinoth",
"display_name": "Vinoth Kumar",
"first_name": "Vinoth",
"last_name": "Kumar",
"photo": "",
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": ""
}

Update current user

This endpoint will update a user profile details. The data to update should be posted in the request body in JSON format.

An authenticated user can update only his profile.

HTTP Request

PUT /api/v2.2/users/{id}

URL Parameters

ParameterDescription
idThe unique id of the user to retrieve
curl --request PUT \
--url http://demo.testpress.in/api/v2.2/users/17/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{\n "first_name": "John",\n "last_name": "Appleseed"\n}'

Response

{
"first_name": "John",
"last_name": "Appleseed",
"email": "testpress.in@gmail.com",
"photo": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/9b69ab73fc924813871b2ef1e2ef00fa.jpeg",
"large_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/493054067d1d4173a22d96b824d7f0c6.jpeg",
"medium_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/8d96dab06a82487ab3149b771fe5d479.jpeg",
"small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/4023a394cd36472fa24db76e493192ce.jpeg",
"x_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/796fa9a9727a42e4a7faa015b0388af3.jpeg",
"mini_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/5f9215132af54acc8e72aed968582763.jpeg",
"x_offset": 37,
"y_offset": 0,
"crop_height": 540,
"crop_width": 539,
"birth_date": "1994-08-27",
"gender": 2,
"address1": "Chennai",
"address2": "Chennai",
"city": "Chennai",
"zip": "600069",
"state_choices": 31,
"phone": "9043570576"
}
- + \ No newline at end of file diff --git a/docs/server-api/students-apis/videos/index.html b/docs/server-api/students-apis/videos/index.html index 6bfb887..f74f62b 100644 --- a/docs/server-api/students-apis/videos/index.html +++ b/docs/server-api/students-apis/videos/index.html @@ -4,13 +4,13 @@ Videos | Testpress docs - +

Videos

The Video API allows authenticated users to access and read all available videos.

Get All Watched Videos

This endpoint retrieves all watched videos for the authenticated user.

HTTP Request

GET /api/v2.5/me/videos_watched/

Query Parameters

ParameterTypeDescription
start_datestringstart date in the format yyyy-mm-dd
end_datestringend date in the format yyyy-mm-dd
coursestringunique coure id
chapterstringunique chapter id

Example:

/api/v2.5/me/videos_watched/?start_date=2023-12-29&end_date=2024-05-29&course=14

This endpoint will get the list of videos watched from the course with ID 14 from December 29, 2023, to May 29, 2024.

curl --request GET \
--url http://demo.testpress.in/api/v2.5/me/videos_watched/
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3RwcmVzcyIsInVzZXJfaWQiOjE3LCJlbWFpbCI6InRlc3RwcmVzcy5pbkBnbWFpbC5jb20iLCJleHAiOjE0NDc4MzMyMjl9.Ik_yi4lHbNbrRGhqmRpsW82Nls_O9lgXakk_syV-vSw' \
--header 'cache-control: no-cache'

Response

{
"count": 2,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"id": 3647,
"title": "Testing Chat",
"watched_duration": null,
"total_duration": "25 seconds",
"created": "2024-04-29T23:57:06.339798+05:30",
"watched_percentage": 0,
"remaining_duration": "25 seconds",
"course_title": "Sample Course",
"chapter_name": "ZLS Demo",
"content_created_date": "2024-04-24T18:28:35+05:30"
},
{
"id": 3646,
"title": "Testing1",
"watched_duration": null,
"total_duration": "41 seconds",
"created": "2024-04-29T23:56:59.034408+05:30",
"watched_percentage": 0,
"remaining_duration": "41 seconds",
"course_title": "Sample Course",
"chapter_name": "sample",
"content_created_date": "2024-04-24T15:07:52+05:30"
}
]
}
- + \ No newline at end of file diff --git a/docs/video-embedding/authentication/index.html b/docs/video-embedding/authentication/index.html index 1ea134e..87f271b 100644 --- a/docs/video-embedding/authentication/index.html +++ b/docs/video-embedding/authentication/index.html @@ -4,13 +4,13 @@ Playback Authentication | Testpress docs - +

Playback Authentication

Access token generated using Testpress API which is required to authorize video playback. Embed code you generated from the admin portal will contain an access token that won't have an expiry date.

If the user has that code he can embed your video onto any page on the internet if you don't have domain restrictions. even if you have, users can view the video by embedding your video on your home or any other page that doesn't restrict users.

You can prevent the above scenario by generating an access token using API with time-to-live or set to expire after one usage on the back-end server and then sent to the website front-end and use generate access_token as part of the video embed code.

Obtaining an Access token

To generate the Access token you need to send an HTTP POST request to the API Endpoint, with the authentication Header and the optional Access token request Body.

https://demo.testpress.in/api/v2.5/admin/videos/{video-id}/access-tokens

You can get the video ID from the admin portal under the video title.

Optional Fields

NameTypedescription
time_to_liveintegerBy default, the Access token validity is set to infinity. You can create shorter-lived URLs by passing the time_to_live parameter. This value is to be set in seconds
expires_after_first_usagebooleanPassing true will make the access token expire immediately after the first usage
annotationsjsonJSON contain all the information about the watermark. Please refer to this doc for details on watermarking.
curl --request POST \
--url https://lms.testpress.in/api/v2.5/admin/videos/6M5ItSrGdcs/access-tokens/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MiwidXNlcl9pZCI6MiwiaW5zdGl0dXRlIjoxNjU1LCJpZCI6MiwiZXhwIjoxNjcxMDkxODE4LCJlbWFpbCI6InN1cHBvcnRAdGVzdHByZXNzLmluIn0.unnuHYMnu_6rxaiOMFouN5-O57psCVb5j7DWq9B28k8' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"time_to_live": 600, "expires_after_first_usage": "true"}'

For valid requests the API server returns a JSON:

{
"url": "https://demo.testpress.in/api/v2.5/admin/videos/{video-id}/access-tokens/ea806eb5-4576-4bef-8489-204e78115d5a/",
"expires_after_first_usage": true,
"code": "ea806eb5-4576-4bef-8489-204e78115d5a",
"status": "Active",
"valid_until": "2022-08-29T12:43:11.288874Z",
"annotations":[]
"playback_url": "https://demo.testpress.in/embed/{video-id}/?access-tokens=ea806eb5-4576-4bef-8489-204e78115d5a"
}
- + \ No newline at end of file diff --git a/docs/video-embedding/domain-restriction/index.html b/docs/video-embedding/domain-restriction/index.html index 60773e8..2cabbde 100644 --- a/docs/video-embedding/domain-restriction/index.html +++ b/docs/video-embedding/domain-restriction/index.html @@ -4,13 +4,13 @@ Domain restriction | Testpress docs - +

Domain restriction

By default vidoes are not domain restricted, so anyone can embed your video onto any page on the internet if they have embed code.

Restrict where your video can be embedded

  • Go to settings page.

  • From the sidebar click on Embed videos

    Domain restriction form

  • Add your website’s subdomain (subdomain.mysite.com) in the text field that appears; be sure to click save to add it. You can specify and manage up to 50 domains where your video can be embedded.

  • Wildcard characters are not supported.

- + \ No newline at end of file diff --git a/docs/video-embedding/getting-starting/index.html b/docs/video-embedding/getting-starting/index.html index 791cf9b..63dcb6f 100644 --- a/docs/video-embedding/getting-starting/index.html +++ b/docs/video-embedding/getting-starting/index.html @@ -4,7 +4,7 @@ Getting started | Testpress docs - + @@ -52,7 +52,7 @@ } }
Result
Loading...
- + \ No newline at end of file diff --git a/docs/video-embedding/player-sdk/android-native-sdk/getting-started/index.html b/docs/video-embedding/player-sdk/android-native-sdk/getting-started/index.html index aa5a37b..4961df2 100644 --- a/docs/video-embedding/player-sdk/android-native-sdk/getting-started/index.html +++ b/docs/video-embedding/player-sdk/android-native-sdk/getting-started/index.html @@ -4,13 +4,13 @@ Getting Started | Testpress docs - +

Getting Started

This SDK enables you to securely stream DRM-protected videos through your Android app.

Sample Android App

Adding dependency

  • If you have a settings.gradle file in your project root, then you need to add the repositories in the settings.gradle inside dependencyResolutionManagement with the given path below. Else, this will go in build.gradle file in project root.
repositories {
// other repo, e.g. google() or mavenCentral()
maven {
url "https://github.com/testpress/maven/raw/main/repo"
}
}

Then reference the library in the dependency section:

dependencies {
implementation "com.tpstreams.player:player:3.0.24"
}

Using ProGuard

If you use ProGuard in your app, you might need to add the following rule to your ProGuard file.

-keep class com.tpstream.player.** { *; }

Initializing Player SDK

You need to initialize the Player SDK at the top level in the Activity.

class PlayerActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_player)
TPStreamsSDK.initialize(TPStreamsSDK.Provider.TestPress, "your_subdomain") // demo for demo.testpress.in
}
}

Integrating player fragment

Drop a TpStreamPlayerFragment into your activity layout with an id. This is the fastest and easiest way to integrate the player into your application. TpStreamPlayerFragment includes a prebuilt UI for the player with ample features and functionality.

<androidx.fragment.app.FragmentContainerView
android:id="@+id/tpstream_player_fragment"
android:name="com.tpstream.player.TpStreamPlayerFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:keepScreenOn="true"
tools:layout="@layout/fragment_tp_stream_player" />

and receive its instance in your activity using findFragmentbyId()

playerFragment = supportFragmentManager.findFragmentById(R.id.tpstream_player_fragment) as TpStreamPlayerFragment

Initializing Player And Starting Playback

You can set listener class with onInitializationSuccess method and receive the player in the onInitializationSuccess callback.

playerFragment.setOnInitializationListener(object: InitializationListener {
override fun onInitializationSuccess(player: TpStreamPlayer) {
this.player = player
}
})

Once you have a player, you can start loading media onto it for playback. You'll need a TpInitParams object to specify which media to load along with your playback preferences.

A TpInitParams object needs videoId, accessToken and orgCode.

try {
val parameters = TpInitParams.Builder()
.setVideoId(videoId) // mandatory
.setAccessToken(accessToken) // mandatory
.build()
player.load(parameters)
} catch (exception: IllegalArgumentException){
// videoId and accessToken must not be null or empty
}

Final code will look like this

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_player)
playerFragment =
supportFragmentManager.findFragmentById(R.id.tpstream_player_fragment) asTpStreamPlayerFragment
playerFragment.setOnInitializationListener(object: InitializationListener {
override fun onInitializationSuccess(player: TpStreamPlayer) {
val parameters = TpInitParams.Builder()
.setVideoId(videoId)
.setAccessToken(accessToken)
.build()
player.load(parameters)
}
});
}

Initializing Player Even Listener

Set up a listener to handle player even.

player.setListener(object : TPStreamPlayerListener {
override fun onPlaybackStateChanged(playbackState: Int) {
Log.d(TAG, "onPlaybackStateChanged: $playbackState")
}

override fun onAccessTokenExpired(videoId: String, callback: (String) -> Unit) {
// Provide the new access token.
val newAccessToken = "5c49285b-0557-4cef-b214-66034d0b77c3"
callback(newAccessToken)
}

override fun onPlayerError(playbackError: PlaybackError) {
Log.d(TAG, "onPlayerError: $playbackError")
}
})

Call this below method to enable auto fullscreen on rotate

  playerFragment.enableAutoFullScreenOnRotate()
- + \ No newline at end of file diff --git a/docs/video-embedding/player-sdk/android-native-sdk/offline-downloads/index.html b/docs/video-embedding/player-sdk/android-native-sdk/offline-downloads/index.html index 3320a9f..588be0f 100644 --- a/docs/video-embedding/player-sdk/android-native-sdk/offline-downloads/index.html +++ b/docs/video-embedding/player-sdk/android-native-sdk/offline-downloads/index.html @@ -4,13 +4,13 @@ Offline Downloads | Testpress docs - +

Offline Downloads

We'll explore the workflow in this document.The Sample Android App on Github provides code examples for a typical use case.

Enable Download support

Create TpInitParams with .enableDownloadSupport(true) to enable download support.

var parameters = TpInitParams.Builder()
.setVideoId(videoId)
.setAccessToken(accessToken)
.enableDownloadSupport(true)
.build()

Creating a TpStreamsDownloadManager

The following code snippet demonstrates how to instantiate a TpStreamsDownloadManager

val tpStreamDownloadManager : TpStreamDownloadManager = TpStreamDownloadManager(activityContext)

Using this TpStreamDownloadManager we can get a list of downloaded media and the following media operations to delete, pause, resume, and cancel.

Get list of downloaded media

val downloads : LiveData<List<Video>?> = tpStreamDownloadManager.getAllDownloads()

It will return a list of OfflineVideoInfo in LiveData to monitor the download progress use ViewModel and observe.

Delete

tpStreamDownloadManager.deleteDownload(video)

Pause

tpStreamDownloadManager.pauseDownload(video)

Resume

tpStreamDownloadManager.resumeDownload(video)

Cancel

tpStreamDownloadManager.cancelDownload(video)

Delete All

tpStreamDownloadManager.deleteAllDownload()

Playing downloaded media

Create offline params and pass them to player activity via intent to play an offline video.

val intent = Intent(activityContext,PlayerActivity::class.java)
intent.putExtra(TP_OFFLINE_PARAMS,TpInitParams.createOfflineParams(video.videoId))
startActivity(intent)
- + \ No newline at end of file diff --git a/docs/video-embedding/player-sdk/flutter-sdk/getting_started/index.html b/docs/video-embedding/player-sdk/flutter-sdk/getting_started/index.html index 940f98c..e42e2d8 100644 --- a/docs/video-embedding/player-sdk/flutter-sdk/getting_started/index.html +++ b/docs/video-embedding/player-sdk/flutter-sdk/getting_started/index.html @@ -4,14 +4,14 @@ Getting Started | Testpress docs - +

Getting Started

To use our Flutter player SDK, add tpstreams_player_sdk as a dependency in your pubspec.yaml file.

Initializing TPStreamsSDK

First, imported our package:

import 'package:tpstreams_player_sdk/tpstreams_player_sdk.dart';

Next, you can initialize the TPStreamsSDK with your subdomain and provider.

TPStreamsSDK.initialize(provider: PROVIDER.testpress, orgCode: "YOUR_SUBDOMAIN");

Make sure to replace "YOUR_SUBDOMAIN" with your actual subdomain. This code snippet should be placed at the entry point of your application (usually in the main function) to ensure proper initialization of the TPStreamsSDK.

Play a Video

To play a video using the TPStreams Player SDK, use the TPStreamPlayer widget:

TPStreamPlayer(assetId: 'VIDEO_ID', accessToken: 'ACCESS_TOKEN')

Replace VIDEO_ID and ACCESS_TOKEN with the actual video ID and accessToken of the video you wish to play. After executing your Flutter application, the TPStreams player will display the video specified by the provided assetId and accessToken.

For a practical implementation and usage of tpstreams_player_sdk, refer to our Sample Flutter App.

- + \ No newline at end of file diff --git a/docs/video-embedding/player-sdk/ios-native-sdk/getting-started/index.html b/docs/video-embedding/player-sdk/ios-native-sdk/getting-started/index.html index 839ada7..4dea903 100644 --- a/docs/video-embedding/player-sdk/ios-native-sdk/getting-started/index.html +++ b/docs/video-embedding/player-sdk/ios-native-sdk/getting-started/index.html @@ -4,13 +4,13 @@ Getting Started | Testpress docs - +

Getting Started

TPStreamsSDK is a versatile iOS native SDK with support for both DRM (FairPlay) and non-DRM content.

Requirements

Before integrating TPStreamsSDK into your iOS application, ensure that your project meets the following requirement:

  • Minimum Deployment Version: iOS 11.4 or later
  • Swift: Version 5.5 or later

Integration using Swift Package Manager (SPM)

To add TPStreamsSDK to your Xcode project using Swift Package Manager, follow these steps:

  • Select File > Add Packages in Xcode.
  • In the search bar, enter the following URL: https://github.com/testpress/iOSPlayerSDK.
  • Select 'iOSPlayerSDK' from the search results. Click Add package button.

Once the package is added, you can start using TPStreamsSDK in your iOS application.

Initializing TPStreamsSDK

In the application(_:didFinishLaunchingWithOptions:) method in your AppDelegate, call TPStreamsSDK.initialize(for: Provider.testpress, withOrgCode:) to initialize the SDK with your organization code.

class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
TPStreamsSDK.initialize(for: Provider.testpress, withOrgCode: "YOUR_SUBDOMAIM")
return true
}
}

Please note that the above code assumes you are using SwiftUI for your application. If you are using a different app architecture, you may need to adapt the integration steps accordingly.

Playing a Video with TPStreamsSDK

SwiftUI Integration

  1. Instantiate a TPAVPlayer by providing the appropriate assetID and accessToken.
  2. Embed the TPStreamPlayerView in your SwiftUI view.
struct ContentView: View {
let player = TPAVPlayer(assetID: "YOUR_VIDEO_ID", accessToken: "VIDEO_ACCESS_TOKEN")

var body: some View {
VStack {
TPStreamPlayerView(player: player)
.frame(height: 240)
Spacer()
}
}
}

UIKit Integration

  1. Instantiate a TPAVPlayer with the relevant assetID and accessToken.
  2. Create an AVPlayerViewController and assign the previously created TPAVPlayer to the player attribute.
  3. Add the AVPlayerViewController.view to the view hierarchy. This will display the video player within the specified playerContainer view.
class ViewController: UIViewController {
@IBOutlet weak var playerContainer: UIView!

var playerViewController: AVPlayerViewController?
var player: TPAVPlayer?

override func viewDidLoad() {
super.viewDidLoad()
self.setupPlayerView()
}

func setupPlayerView(){
player = TPAVPlayer(assetID: "YOUR_ASSET_ID", accessToken: "VIDEO_ACCESS_TOKEN")
playerViewController = AVPlayerViewController()
playerViewController?.player = player

addChild(playerViewController!)
playerContainer.addSubview(playerViewController!.view)
playerViewController!.view.frame = playerContainer.bounds
}
}
info

TPAVPlayer is a wrapper class of AVPlayer that provides built-in support for playing our videos without requiring additional effort. It also supports FairPlay streaming for DRM-protected content.

Since TPAVPlayer is a wrapper class of AVPlayer, you can also use the TPAVPlayer with native iOS player to play Testpress Videos.

For a practical implementation and usage of TPStreamsSDK, refer to our Sample iOS App.

- + \ No newline at end of file diff --git a/docs/video-embedding/player-sdk/javascript-sdk/introduction/index.html b/docs/video-embedding/player-sdk/javascript-sdk/introduction/index.html index 2fd25a9..0b68d7e 100644 --- a/docs/video-embedding/player-sdk/javascript-sdk/introduction/index.html +++ b/docs/video-embedding/player-sdk/javascript-sdk/introduction/index.html @@ -4,13 +4,13 @@ About player SDK | Testpress docs - +

About player SDK

Our player SDK enables you to interact with embedded Testpress players through the code on your web page. You can modify the default behavior of the player for features like looping, execute custom functions on particular playback events, and even set basic properties like the volume, and playback rate of the player.

The SDK, as a JavaScript library, is completely separate from the API. You connect to it differently, and it gives you a different range of options.

- + \ No newline at end of file diff --git a/docs/video-embedding/player-sdk/javascript-sdk/player-events/index.html b/docs/video-embedding/player-sdk/javascript-sdk/player-events/index.html index d144e73..8f0c3fb 100644 --- a/docs/video-embedding/player-sdk/javascript-sdk/player-events/index.html +++ b/docs/video-embedding/player-sdk/javascript-sdk/player-events/index.html @@ -4,13 +4,13 @@ Player Events | Testpress docs - +

Player Events

About Player events

You can listen for events in the player by attaching a callback using .on()

player.on('ended', function() {
// Executes when the video is ended
});

The events are equivalent to the HTML5 video events.

To remove a listener, call .off() with the callback function. If you pass an event name only, you remove all listeners for that event.

var onPlay = function() {

};

player.on('ended', onPlay);

// If later you decide that you don't need to listen for `ended`
player.off('ended', onPlay);

// Alternatively, call `off` with just the event name to remove all listeners
player.off('ended');

Events for playback controls

  • ended
  • error
  • loaded
  • pause
  • play
  • progress
  • seeked
  • timeupdate
  • volumechange
  • ratechange

ended

This event fires when playback reaches the end of a video.

info

When the player's loop behavior is enabled, the ended event doesn't fire.

loaded

This event fires when a new video is loaded in the player.

volume

This event fires when the volume in the player changes.

timeupdate

This event fires when the playback position of the video changes, generally every 250 ms during playback, but the interval can vary depending on the browser.

seeked

This event fires when the player seeks a specific time. A simultaneous timeupdate event also fires.

progress

This event fires while the video is loading. The event data indicates the amount of the video that has been buffered.

play

This event fires when the video plays.

pause

This event fires when the video is paused.

error

This event fires when the player experiences some sort of error. If a method call generated the error, the name of the method appears in the event data, along with the name of the error.

ratechange

This event fires when the playback rate of the video in the player changes.

- + \ No newline at end of file diff --git a/docs/video-embedding/player-sdk/javascript-sdk/player-methods/index.html b/docs/video-embedding/player-sdk/javascript-sdk/player-methods/index.html index 4118f00..22d9cb9 100644 --- a/docs/video-embedding/player-sdk/javascript-sdk/player-methods/index.html +++ b/docs/video-embedding/player-sdk/javascript-sdk/player-methods/index.html @@ -4,7 +4,7 @@ Player Methods | Testpress docs - + @@ -12,7 +12,7 @@

Player Methods

About player methods

You can call player methods by calling the corresponding function on the Player object. All player method executes only after the iframe is loaded, so no need to wait for the player to loaded to call the methods.

player.play();

All methods, except for on() and off(), return a Promise — a special JavaScript object that stands for the result of the operation, whether success or failure.

Promises for methods that return information resolve with the value of the property in question.

player.getLoop().then(function(loop) {
// Whether the player is set to loop
});

Get the playback position of a video

This method gets the current playback position of a video, measured in seconds.

Function

getCurrentTime()

Returns

Promise <number>

Example

player.getCurrentTime().then(function(seconds) {
// `seconds` indicates the current playback position of the video
});

Get the loop state of a player

This method gets the loop state of a player, where true indicates that the video restarts once it reaches the end of playback.

Function

getLoop()

Returns

Promise <boolean>

Example

player.getLoop().then(function(loop) {
// `loop` indicates whether the loop behavior is active
});

Get the pause state of a player

This method gets the pause state of the current player, where true indicates that playback is paused.

Function

getPaused()

Returns

Promise <boolean>

Example

player.getPaused().then(function(paused) {
// `paused` indicates whether the player is paused
});

Get the ended state of a video

This method gets the ended state of the video, where true indicates that the video has ended. The video has ended if its current playback position is exactly equal to its duration.

Function

getEnded()

Returns

Promise <boolean>

Example

player.getEnded().then(function(ended) {
// `ended` indicates whether the video has ended
});

Get the playback rate of a player

This method gets the playback rate of a player on a scale from 0.5 to 2, where 0.5 is half speed and 2 is double speed.

Function

getPlaybackRate()

Returns

Promise <number>

Example

player.getPlaybackRate().then(function(playbackRate) {
// `playbackRate` indicates the numeric value of the current playback rate
});

Get the volume level of a player

This method gets the volume level of a player on a scale of 0 to 1.

info

Most mobile devices don't support a volume level independent of the system volume. In these cases, this method always returns 1.

Function

getVolume()

Returns

Promise <number>

Example

player.getVolume().then(function(volume) {
// `volume` indicates the volume level of the player
});

Get user watched time ranges

This methods returns the list of time ranges that user watched in a video.

Function

played()

Returns

Promise <Array>

Example

player.played().then(function(ranges) {
// ranges => [[0, 120.084666], [155.292928, 161.054032], ...]
});

Pause a video

This method pauses the playback of a video.

Function

pause()

Returns

Promise <void>

Example

player.pause().then(function() {
// The video is paused
}).catch(function(error) {
// Some other error occurred
});

Play a video

This method plays the playback of a video.

Function

play()

Returns

Promise <void>

Example

player.play().then(function() {
// The video is paused
}).catch(function(error) {
// Some other error occurred
});

Set the playback position of a video

This method sets the current playback position in seconds. The player attempts to seek to as close to the specified time as possible. The exact time comes back as the fulfilled value of the promise.

If playback hasn't started yet, using this method starts playback.
If playback has already started, using this method doesn't affect the play state.

info

If the player is paused, it remains paused. If the player is playing, it buffers the video from the new position and then resumes playing.

Function

setCurrentTime(seconds)

Parameters

ParameterData typeRequired?Description
secondsNumberYesThe playback position in seconds.

Returns

Promise <number, (RangeError | Error)>

Errors

ErrorDescription
RangeErrorThe time is less than 0 or greater than the video's duration.
ErrorSome other error occurred.

Example

player.setCurrentTime(30.456).then(function(seconds) {
// `seconds` indicates the actual time that the player seeks to
}).catch(function(error) {
switch (error.name) {
case 'RangeError':
// The time is less than 0 or greater than the video's duration
break;
default:
// Some other error occurred
break;
}
});

Set the autoplay state of a player or browser

This method enables or disables autoplay in a player or browser, where true indicates that autoplay is enabled. Under autopause, whenever a new video loads in the browser window, the video begins in a played state. By default autoplay was disabled.

info

The autopause feature has no effect if you've disabled cookies in your browser, either through browser settings or with an extension or plugin.

Function

setAutoPlay({autoplay})

Parameters

ParameterData typeRequired?Description
autopauseBooleanYesThe autopause state to set.

Returns

Promise <boolean, (UnsupportedError | Error)>

Errors

ErrorDescription
UnsupportedErrorAutopause isn't supported by the current player or browser.
ErrorSome other error occurred.

Example

player.setAutoPlay(false).then(function(autopause) {
// Autoplay is disabled
}).catch(function(error) {
// Handle errors
});

Set the loop state of a player

This method sets the loop state of the player. When the loop state is true, playback resumes at the beginning of the video immediately after the video ends.

Function

setLoop(loop)

Parameters

ParameterData typeRequired?Description
loopBooleanYesWhether the player loops video playback.

Returns

Promise <boolean>

Example

player.setLoop(true).then(function(loop) {
// The loop behavior is enabled
});

Set the playback rate of a player

This method sets the playback rate of the player on a scale from 0.5 to 2, where 0.5 is half speed and 2 is double speed. When you set the playback rate through the API, the specified value isn't synchronized to other players or stored as the viewer's preference.

Function

setPlaybackRate(playbackRate)

Parameters

ParameterData typeRequired?Description
playbackRateNumberYesThe playback rate of the player from 0.5 to 2.

Returns

Promise <number, (RangeError | Error)>**

Errors

ErrorDescription
RangeErrorThe playback rate is less than 0.5 or greater than 2.
ErrorSome other error occurred.

Example

player.setPlaybackRate(0.5).then(function(playbackRate) {
// The playback rate is set
}).catch(function(error) {
switch (error.name) {
case 'RangeError':
// The playback rate is less than 0.5 or greater than 2
break;
default:
// Some other error occurred
break;
}
});

Set the volume level of a player

This method sets the volume level of the player on a scale from 0 to 1. When you set the volume through the API, the specified value isn't synchronized to other players or stored as the viewer's preference.

Function

setVolume(volume)

Parameters

ParameterData typeRequired?Description
volumeNumberYesThe volume level of the player from 0 to 1.

Returns

Promise <number, (RangeError | Error)>

Errors

ErrorDescription
RangeErrorThe volume is less than 0 or greater than 1.
ErrorSome other error occurred.

Example

player.setVolume(0.5).then(function(volume) {
// The volume is set
}).catch(function(error) {
switch (error.name) {
case 'RangeError':
// The volume is less than 0 or greater than 1
break;
default:
// Some other errors occurred
break;
}
});

Apply watermark to the video

This method applies watermark to the video. Please refer to this doc for more details on watermarking.

Function

applyWatermark()

Parameters

ParameterData typeRequired?
annotationsjsonYes

Returns

Promise <void>

Example

const annotations = [
{
"type":"dynamic",
"text":"Dinesh",
"opacity":"0.8",
"color":"#FF0000",
"size":"5",
"interval":5000,
"skip": 2000
}
]
player.applyWatermark(annotations).then(function() {
// The watermark is applied
})
- + \ No newline at end of file diff --git a/docs/video-embedding/player-sdk/javascript-sdk/plugins/markers/index.html b/docs/video-embedding/player-sdk/javascript-sdk/plugins/markers/index.html index b44c4a2..856600f 100644 --- a/docs/video-embedding/player-sdk/javascript-sdk/plugins/markers/index.html +++ b/docs/video-embedding/player-sdk/javascript-sdk/plugins/markers/index.html @@ -4,13 +4,13 @@ Markers | Testpress docs - +

Markers

Enable plugin

You can enable a plugin by passing query param plugins with value "markers to src URL"

Initialize markers

You can intialize markers through Player SDK method call setMarkers

Arguments

NameTypedescription
markerDisplayObjectThe general css styling that would be applied to all the markers created by the plugin. The default is only concerned with width, border-radius, and background-color, but any other css rules would be applied too (think of it as jQuery's css function).
breakOverlayObjectOptions for the break overlays at each marker. Available fields => display, displayTime, style

You can read more about available arguments here

Events

Namedescription
onMarkerReachedThis callback function is triggered whenever playback reaches the time interval from a marker. The interval is specified in the breakOverlay.displayTime . This can be used to trigger certain actions at each marker, depending on your use case. Again, this function is given a marker instance. In 0.6.0, the function also takes in a second parameter index.
onMarkerClickThis callback function is triggered when clicking on the markers. The default behavior for clicking on the marker is seeking to that point in the video. However, if onMarkerClick returns false, the default behavior will be prevented.

Methods

Remove markers

You can remove the particular markers by passing its indices to removeMarkers function.

player.removeMarkers([1,2,4]);

Remove All markers

player.removeAllMarkers([1,2,4]);

Sample code

<!DOCTYPE html>
<html>
<body>
<div style="padding-top:56.25%;position:relative;"><iframe id="video_player" src="https://lms.testpress.in/embed/cnwKtQwNmbG/?access_token=fb92ae61-5b1e-4822-a2e9-e402e07c3e5e&plugins=markers" style="border:0;max-width:100%;position:absolute;top:0;left:0;height:100%;width:100%;" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope picture-in-picture" allowfullscreen="" frameborder="0"></iframe></div>
<script src="https://lms.testpress.in/static/video_player/player.js"></script>
<script>
var player = new Testpress.Player(document.getElementById("video_player"));
player.loaded().then(()=>{
player.setMarkers({
markerStyle: {
'width': '7px',
'border-radius': '30%',
'background-color': 'yellow'
},
markers: [{
time: 60,
text: "marker",
},
{
time: 120,
text: "marker2",
},
{
time: 180,
text: "marker3",
}
]
});

})

player.on("onMarkerReached", (marker, index)=>{
console.log("onMarkerReached", marker, index)
player.removeMarkers([index])
})

player.on("onMarkerClick", (marker)=>{
console.log("onMarkerClick", marker)
})

</script>
</body>
</html>

Output

Domain restriction form

- + \ No newline at end of file diff --git a/docs/video-embedding/player-sdk/javascript-sdk/using-player-sdk/index.html b/docs/video-embedding/player-sdk/javascript-sdk/using-player-sdk/index.html index bfeba17..cfabee8 100644 --- a/docs/video-embedding/player-sdk/javascript-sdk/using-player-sdk/index.html +++ b/docs/video-embedding/player-sdk/javascript-sdk/using-player-sdk/index.html @@ -4,13 +4,13 @@ Using Player SDK | Testpress docs - +

Using Player SDK

The iframe embed lets you embed your Testpress videos and control the player using Javascript. You have access to the essential methods and properties of the players. There are events that you can listen for and execute custom actions in your web application.

Adding the script

Add the following script to the html of your web page. This loads the interface that are used to establish communication with the video player. If this script is loaded on-demand later, make sure to wait for the load to complete before calling subsequent methods on the object.

<script src="https://sandbox.testpress.in/static/video_player/player.js"></script>

Get a reference to the iframe

Note: Assuming the API script (above) is already loaded,

To begin communicating with the player, get a reference to the iframe element. This can be using DOM APIs such as querySelector().

const iframe = document.querySelector("iframe");

Establish communication with the iframe

<html>
<head>
<title>page_title</title>
</head>
<body>
<iframe width='560' height='315' src='https://lms.testpress.in/embed/cnwKtQwNmbG' title='DDE video 12' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>
<script src="https://lms.testpress.in/static/video_player/player.js"></script>
<script>
var iframe = document.querySelector('iframe');
var player = new Testpress.Player(iframe);

player.loaded().then(()=>{
console.log('Player is ready now')
});


player.on('play', function() {
console.log('Played the video')
});


player.setCurrentTime(30).then(()=>{
console.log('Current watch time updated')
});
</script>

</body>
</html>


What's next

It's time to start controlling some videos. We've compiled a comprehensive reference of methods and events to make your dreams of absolute power a reality.

If we've confused you going forward, contact us. We tend to get it right the second time.

- + \ No newline at end of file diff --git a/docs/video-embedding/server-apis/access_token/index.html b/docs/video-embedding/server-apis/access_token/index.html index 85ec187..c85a32a 100644 --- a/docs/video-embedding/server-apis/access_token/index.html +++ b/docs/video-embedding/server-apis/access_token/index.html @@ -4,13 +4,13 @@ Access token | Testpress docs - +

Access token

List Access tokens

Make get request to the below API with your video id to list access tokens

https://demo.testpress.in/api/v2.5/admin/videos/{video-id}/access-tokens

Query parameters

ParameterData type
is_activeboolean

Response

{
"count": 4,
"next": null,
"previous": null,
"per_page": 20,
"results": [
{
"url": "https://demo.testpress.in/api/v2.5/admin/videos/T5ytuyF04NC/access-tokens/6c15094e-bd08-422c-93ba-2cd71867e035/",
"expires_after_first_usage": true,
"code": "6c15094e-bd08-422c-93ba-2cd71867e035",
"status": "Expired",
"valid_until": "2022-09-04T19:19:06.399581Z",
"annotations": [
{
"text": "moving text",
"type": "dynamic",
"color": "#FFFF00",
"opacity": "0.30",
"size": 5,
"interval": 2500,
"skip": 20,
"x": 21,
"y": 21
},
{
"text": "moving text",
"type": "dynamic",
"color": "#FFFF00",
"opacity": "0.30",
"size": 5,
"interval": 2500,
"skip": 20,
"x": 21,
"y": 21
}
]
},
{
"url": "https://demo.testpress.in/api/v2.5/admin/videos/T5ytuyF04NC/access-tokens/2c6f4c16-9a8e-4739-9827-d141f68452aa/",
"expires_after_first_usage": false,
"code": "2c6f4c16-9a8e-4739-9827-d141f68452aa",
"status": "Expired",
"valid_until": "2022-09-04T19:13:01.619546Z",
"annotations": [
{
"text": "moving text",
"type": "dynamic",
"color": "#FFFF00",
"opacity": "0.30",
"size": 5,
"interval": 2500,
"skip": 20,
"x": 21,
"y": 21
},

{
"url": "https://demo.testpress.in/api/v2.5/admin/videos/T5ytuyF04NC/access-tokens/26fe0ae0-6450-4b10-8541-2379815071ba/",
"expires_after_first_usage": false,
"code": "26fe0ae0-6450-4b10-8541-2379815071ba",
"status": "Expired",
"valid_until": "2022-09-04T19:13:01.639349Z",
"annotations": [
{
"text": "moving text",
"type": "dynamic",
"color": "#FFFF00",
"opacity": "0.90",
"size": 25,
"interval": 1500,
"skip": 10,
"x": 11,
"y": 11
}
]
},
{
"url": "https://demo.testpress.in/api/v2.5/admin/videos/T5ytuyF04NC/access-tokens/4a802a74-4ebb-473d-8f41-8e624279aba6/",
"expires_after_first_usage": false,
"code": "4a802a74-4ebb-473d-8f41-8e624279aba6",
"status": "Expired",
"valid_until": "2022-09-04T19:11:52.247073Z",
"annotations": []
}
]
}

View Access token

Make get request to the below API with your video id and access token code to get the access token details

https://demo.testpress.in/api/v2.5/admin/videos/{video-id}/access-tokens/{access_token_code}/

Response

{
"url": "https://demo.testpress.in/api/v2.5/admin/videos/{video-id}/access-tokens/your_access_token_code/",
"expires_after_first_usage": false,
"code": "your_access_token_code",
"status": "Active",
"valid_until": "2022-08-30T14:24:23.835382Z",
"annotations":[]
}

Update Access token

https://demo.testpress.in/api/v2.5/admin/videos/{video-id}/access-tokens/{access_token_code}/

This code below updates the access_token time_to_live.

{
time_to_live: 300
}

Response

{
"url": "https://demo.testpress.in/api/v2.5/admin/videos/{video-id}/access-tokens/your_access_token_code/",
"expires_after_first_usage": false,
"code": "your_access_token_code",
"status": "Active",
"valid_until": "2022-08-30T14:24:23.835382Z",
"annotations":[]
}
- + \ No newline at end of file diff --git a/docs/video-embedding/watermarking/index.html b/docs/video-embedding/watermarking/index.html index 1581d02..071a8e9 100644 --- a/docs/video-embedding/watermarking/index.html +++ b/docs/video-embedding/watermarking/index.html @@ -4,13 +4,13 @@ Watermark Videos | Testpress docs - +

Watermark Videos

Videos hosted through testpress cannot be downloaded. There does however remain the risk of piracy from screen capture. Add text to videos with our dynamic watermark feature that effectively prevents users from pirating video content using screen capture, and goes a long way towards helping users protect their premium content.

The dynamic watermark can be customized for movement, color, size and transparency.

Create Watermark Code

Here is a sample JSON string that adds a moving (dynamic) watermark and a static watermark.

{
"annotations":[
{
"type":"static",
"text":"Testpress",
"x":10,
"y":10,
"opacity":"0.5",
"color":"#FFF",
"size":6
},
{
"type":"dynamic",
"text":"hari",
"opacity":"0.5",
"color":"#FF0000",
"size":6,
"interval":5000,
"skip":2000
}
]
}

Technically, this is an array of JSON objects, where each object describe a single annotation item.

Each of these items will be described by its parameters. Every item requires a type parameter which defines the type of watermark by default its value was static. The type of watermark can be either a moving text or a static text. The rest of the parameters depends on the type.

Following is a short description of how each parameter affects the display of text.

Static text

The following code will display a static watermark code, placed at 10px distance from the left border of the video and 50px from top border, displaying text Testpress . The text color will be white (#fff), opacity is 0.5, and font-size is 6.

[{
"type": "static",
"text": "Testpress",
"x": 10",
"y": 10,
"opacity": "0.5",
"color": "#FFF",
"size": "6"
}]

Moving text

The following code will display a dynamic watermark code, displaying text hari. The text color will be red (#ff0000), opacity is 0.8, and font-size is 6. The watermark is configured to update position every 5 seconds (5000ms).

[{
'type': 'dynamic',
'text': 'hari',
'opacity': '0.8',
'color': '#FF0000',
'size': '6',
'interval': 5000,
'skip': 2000,
}]

Type of text

Set type parameter as dynamic for Dynamic watermark and static for Static watermark

'type':'dynamic',

Set the text to be shown

'text" : 'testpress',

Specify text opacity

This is the opacity of the text. For full opacity keep value 1.

'opacity':'0.8',

Specify text color

This is the hex value of the watermark text color.

'color':'#FF0000',

Specify the font size

This is the font size

'size':6,

Specify the interval over which watermark changes position

The value is the interval in milliseconds when the text changes position

'interval':5000,

Skip feature for watermark

It is possible to have watermark skip for some time between two overlays. Here is a sample code for it –

'skip':2000

Apply Watermark

Now you just need pass the watermark code that you've created to the player to apply on the video. There are two ways to do that

- + \ No newline at end of file diff --git a/index.html b/index.html index d6d82b8..157728f 100644 --- a/index.html +++ b/index.html @@ -4,13 +4,13 @@ Hello from Testpress docs | Testpress docs - +

Testpress docs

Video DRM Encryption

No downloader, plugin or hack can download the videos streamed through Testpress.

Dynamic Watermarking

Total Screen Capture Block in Mobile Apps. Discourage screen capture in websites with user based watermark like IP address, user id, email id, phone no. etc.

Upload & Embed on Your Site Or App

Embed player with subtitles, multiple qualities & speed change options. Option for the viewer to download securely in mobile app and play offline.

- + \ No newline at end of file diff --git a/markdown-page/index.html b/markdown-page/index.html index 71f3947..2cb4bfb 100644 --- a/markdown-page/index.html +++ b/markdown-page/index.html @@ -4,13 +4,13 @@ Markdown page example | Testpress docs - +

Markdown page example

You don't need React to write simple standalone pages.

- + \ No newline at end of file