Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating LMS APIs to DRF #35057

Open
17 of 45 tasks
Tracked by #32609
awais786 opened this issue Jul 2, 2024 · 10 comments
Open
17 of 45 tasks
Tracked by #32609

Migrating LMS APIs to DRF #35057

awais786 opened this issue Jul 2, 2024 · 10 comments
Labels
epic Large unit of work, consisting of multiple tasks

Comments

@awais786
Copy link
Contributor

awais786 commented Jul 2, 2024

This document Big changes to edx-platform contains a segment to convert

Improve HTTP APIs.

  1. Switch all APIs to be using DRF with standard Auth classes.
  2. Document APIs to clearly separate Operator, Instructor, and Learner APIs.
  3. Map existing APIs to product features and build out missing APIs.
  4. Define best practices for how to build APIs?

How to test Instructor APIS

Tasks releated with 1st point Switch all APIs to be using DRF with standard Auth classes.

  1. awais786
  2. awais786
  3. pnaskardev
  4. awais786
  5. awais786
  6. awais786
  7. awais786
  8. awais786
  9. awais786
  10. awais786
  11. awais786
  12. awais786
  13. awais786
  14. awais786
  15. awais786
  16. awais786
  17. awais786
  18. awais786
  19. awais786
  20. awais786
  21. awais786
  22. awais786
  23. awais786
  24. awais786
  25. awais786
  26. awais786

Tasks

No tasks being tracked yet.
@awais786 awais786 added the epic Large unit of work, consisting of multiple tasks label Jul 2, 2024
@awais786
Copy link
Contributor Author

awais786 commented Jul 19, 2024

PRS List

  1. feat: converting existing api to drf base api ( 1st api ). get_student_progress_url #35039
  2. feat: Upgrading api list_course_role_members ( 2nd api ) #35105
  3. feat: upgrading simple api to drf compatible ( 3rd api ) list_email_content #35111
  4. feat: upgrading simple api to drf compatible (4th api ), list_entrance_exam_instructor_tasks #35135
  5. feat: Upgrading api to use drf 5th api. register_and_enroll_students api #35084
  6. feat: upgrading simple api to drf compatible (6th) . modify_access #35260
  7. upgrade get_students_features api with DRF( 7th api ) #35323
  8. feat: get_students_who_may_enroll update api to DRF ( 8th ) #35174
  9. feat: show_student_extensions upgrading api to drf compatible ( 9th )  #35148
  10. feat: upgrading list_instructor_tasks to DRF ( 10th ) #35332
  11. feat: Update forum role membership api to DRF ( 11th ) #35343
  12. feat: upgrading get_anon_ids api to drf compatible (12) #35345
  13. feat: upgrade list_report_downloads api to DRF ( 13th ) #35350
  14. feat: list_forum_members-to-drf api to drf ( 14th ) #35366
  15. feat: upgrade send_email api to drf ( 15th ) #35387
  16. feat: upgrade change_due date to drf ( 16th ) #35392
  17. feat: upgrading simple api to drf compatible ( 17th ) #35394
  18. feat: upgrading show_unit_extensions api to drf compatible ( 18th ) #35395
  19. feat: upgrade reset_student_attempts api to drf ( 19th ) #35404
  20. feat!: upgrading get_grading_config api with DRF ( 20th ) #35463
  21. feat!: upgrading mark_student_can_skip_entrance_exam api with DRF ( 21 ) #35460
  22. feat: upgrade get_student_enrollment_status api with drf (22nd) #35464
  23. feat!: upgrade certificate_invalidation_view to drf ( 23 ) #35521
  24. feat!: upgrade get_issued_certificates to DRF ( 24 ) #35534
  25. feat!: upgrading start_certificate_generation-to-drf api to DRF ( 25 ) #35536

@awais786
Copy link
Contributor Author

awais786 commented Aug 8, 2024

Testing guide lines via postman

How to generate csrf
http://local.edly.io:8000/csrf/api/v1/token
It will return the csrf token which is required for some apis.

For login authentication
http://local.edly.io:8000/api/user/v2/account/login_session/
body-form-data
email_or_username = admin
password = edx

headers information
x-csrftoken: csrf fresh token

Generate access token via postman
http://local.edly.io:8000/oauth2/access_token

You can curl command as well as follows. Just pass your token.

curl --location ‘http://local.edly.io:8000/courses/course-v1:edx+cs222+2311/instructor/api/get_student_progress_url’
–header ‘Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJvcGVuZWR4IiwiZXhwIjoxNzI0MjMzNDc2LCJncmFudF90eXBlIjoiY2xpZW50LWNyZWRlbnRpYWxzIiwiaWF0IjoxNzI0MjI5ODc2LCJpc3MiOiJodHRwOi8vbG9jYWwuZWRseS5pby9vYXV0aDIiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiNlX3VzZXIiLCJzY29wZXMiOlsicmVhZCIsIndyaXRlIiwiZW1haWwiLCJwcm9maWxlIl0sInZlcnNpb24iOiIxLjIuMCIsInN1YiI6IjI2MjYyNDAxYzUyOGQ3YzRhNmJiZWFiZTA0NTVlYzQ2IiwiZmlsdGVycyI6W10sImlzX3Jlc3RyaWN0ZWQiOmZhbHNlLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiZW1haWwiOiJsb2dpbl9zZXJ2aWNlX3VzZXJAZmFrZS5lbWFpbCIsIm5hbWUiOm51bGwsImZhbWlseV9uYW1lIjoiIiwiZ2l2ZW5fbmFtZSI6IiIsImFkbWluaXN0cmF0b3IiOmZhbHNlLCJzdXBlcnVzZXIiOmZhbHNlfQ.t1GjtoPntvTgY153qlkoUHZ2N43U-Ac5uJY5EUTEo0g’ 
-X POST --form ‘unique_student_identifier=“audot”’

@AmauryVanEspen
Copy link

AmauryVanEspen commented Aug 13, 2024

Amazing list and job @awais786 ! thank you very much for this very relevant list !
Where can we find the postman workspace & collections ?
Thanks.
Amaury

@awais786
Copy link
Contributor Author

@AmauryVanEspen you can find some help material from here

Please let me know if you have some questions.

@awais786
Copy link
Contributor Author

@AmauryVanEspen You can use these open tickets.

@AmauryVanEspen
Copy link

Hi @awais786
trying to set up the Postman Collection, with the CSRF tricks, i still have an issue
https://openedx.atlassian.net/wiki/spaces/AC/pages/3516268561/How+to+authenticate+and+query+edX+APIs+with+Postman
returning : 405 Method Not Allowed

not sure about how to add the script : var xsrfCookie = postman.getResponseCookie("csrftoken"); postman.setEnvironmentVariable('csrftoken', xsrfCookie.value);

collection folder ? the post-request script of the POST ?
Thanks.
Amaury

@awais786
Copy link
Contributor Author

Hi @awais786 trying to set up the Postman Collection, with the CSRF tricks, i still have an issue https://openedx.atlassian.net/wiki/spaces/AC/pages/3516268561/How+to+authenticate+and+query+edX+APIs+with+Postman returning : 405 Method Not Allowed

not sure about how to add the script : var xsrfCookie = postman.getResponseCookie("csrftoken"); postman.setEnvironmentVariable('csrftoken', xsrfCookie.value);

collection folder ? the post-request script of the POST ? Thanks. Amaury

Please try this.
https://discuss.openedx.org/t/authenticate-with-oauth-token-to-access-api-endpoints-instructor-apis-d/13658

@awais786
Copy link
Contributor Author

@AmauryVanEspen Please check the last post with postman collection

@AmauryVanEspen
Copy link

@AmauryVanEspen Please check the last post with postman collection

hi @awais786
thanks,
which instance should i use ?
prod ? or a simple EduNExt Trial ? or is there an instance available for migration LMS API to DRF available ?
Thanks
Regards
Amaury

@awais786
Copy link
Contributor Author

@AmauryVanEspen I am using local tutor instance for testing purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic Large unit of work, consisting of multiple tasks
Projects
Status: In Progress
Development

No branches or pull requests

2 participants