Skip to content

Commit 1ade21a

Browse files
endpoint for updating the ceritifactes
1 parent c8cf97d commit 1ade21a

4 files changed

Lines changed: 578 additions & 85 deletions

File tree

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,85 @@ user = User.objects.get(email='test@gmail.com')
223223
```
224224

225225

226+
227+
## API Endpoints
228+
229+
All API endpoints require authentication using a valid token in the Authorization header: `Token <token_key>`
230+
231+
### Homework Data
232+
233+
**Endpoint:** `GET /data/{course_slug}/homework/{homework_slug}`
234+
235+
**Description:** Retrieves comprehensive homework data including course information, homework details, and all student submissions with their answers.
236+
237+
**Response:** Returns course data, homework details, and an array of submissions with:
238+
- Student information
239+
- Homework submission details (links, time spent, scores)
240+
- Individual question answers with correctness
241+
- Learning in public contributions
242+
- FAQ contributions
243+
244+
### Project Data
245+
246+
**Endpoint:** `GET /data/{course_slug}/project/{project_slug}`
247+
248+
**Description:** Retrieves comprehensive project data including course information, project details, and all student submissions with their scores and peer review information.
249+
250+
**Response:** Returns course data, project details, and an array of submissions with:
251+
- Student information and GitHub links
252+
- Project scores (project, FAQ, learning in public, peer review)
253+
- Peer review status and scores
254+
- Pass/fail status
255+
- Time spent and learning in public links
256+
257+
### Graduates Data
258+
259+
**Endpoint:** `GET /data/{course_slug}/graduates`
260+
261+
**Description:** Retrieves a list of students who have successfully completed the course by passing the minimum required number of projects.
262+
263+
**Response:** Returns an array of graduates with:
264+
- Student email
265+
- Certificate name (or display name if certificate name not set)
266+
267+
### Update Enrollment Certificate
268+
269+
**Endpoint:** `POST /data/{course_slug}/update-certificate`
270+
271+
**Description:** Updates the certificate URL for a user's enrollment in a specific course.
272+
273+
**Request Body:**
274+
```json
275+
{
276+
"email": "user@example.com",
277+
"certificate_path": "/path/to/certificate.pdf"
278+
}
279+
```
280+
281+
**Response:**
282+
```json
283+
{
284+
"success": true,
285+
"message": "Certificate URL updated for user@example.com in course course-slug",
286+
"enrollment_id": 123,
287+
"certificate_url": "/path/to/certificate.pdf"
288+
}
289+
```
290+
291+
**Error Responses:**
292+
- `400 Bad Request`: Missing required fields or invalid JSON
293+
- `401 Unauthorized`: Missing or invalid authentication token
294+
- `404 Not Found`: User not found or not enrolled in the course
295+
- `405 Method Not Allowed`: Wrong HTTP method (only POST allowed)
296+
- `500 Internal Server Error`: Server error
297+
298+
**Example Usage:**
299+
```bash
300+
curl -X POST \
301+
-H "Authorization: Token your_token_here" \
302+
-H "Content-Type: application/json" \
303+
-d '{"email": "student@example.com", "certificate_path": "/certificates/student-cert.pdf"}' \
304+
http://localhost:8000/data/python-for-data-science/update-certificate
305+
```
306+
307+

0 commit comments

Comments
 (0)