@@ -7,6 +7,7 @@ The Requests API provides endpoints for creating, fetching, and updating request
7
7
| [ GET /requests] ( #get-requests ) | Returns a list of requests with pagination and filtering options. |
8
8
| [ POST /requests] ( #post-requests ) | Creates a new request. |
9
9
| [ PUT /requests/: id ] ( #put-requestsid ) | Updates an existing request. |
10
+ | [ PATCH /requests/: id ] ( #patch-requestsid ) | Updates an existing request before approval or rejection. |
10
11
11
12
### ** GET /requests**
12
13
@@ -344,7 +345,7 @@ Updates an existing request with the provided details.
344
345
- **Code:** 404
345
346
- **Content:** `{ "statusCode": 404, "error": "Not Found", "message": "Request does not exist" }`
346
347
- **Code:** 500
347
- - **Content:** `{ "statusCode": 500, "error": "Internal Server Error", "message": "" An internal server error occurred" }`
348
+ - **Content:** `{ "statusCode": 500, "error": "Internal Server Error", "message": "An internal server error occurred" }`
348
349
- **Code:** 401
349
350
- **Content:** `{ "statusCode": 401, "error": "Unauthorized", "message": "Unauthenticated User" }`
350
351
- **Code:** 401
@@ -359,6 +360,84 @@ Updates an existing request with the provided details.
359
360
- The request body should contain the necessary details for updating an existing request, including type, reason, and state.
360
361
- Error handling is provided for cases where the request is already approved and for internal server errors.
361
362
363
+ ### **PATCH /requests/:id**
364
+
365
+ Updates an existing request before approval or rejection with the provided details.
366
+
367
+ - **Description:** Updates an existing request before approval or rejection with the provided details..
368
+
369
+ - **URL:** `https://api.realdevsquad.com/requests/:id`
370
+
371
+ - **Method:** PATCH
372
+
373
+ - **Path Parameters:**
374
+
375
+ - `id`: The unique identifier of the request to be updated.
376
+
377
+ - **Query Parameters:**
378
+
379
+ - `dev`: Required boolean to update requests in developer mode.
380
+
381
+ - **Headers:**
382
+ - Content-Type: application/json
383
+ - **Cookie:**
384
+
385
+ - rds-session: `<JWT>`
386
+
387
+ - **Request Body:**
388
+
389
+ - Body Parameters:
390
+
391
+ - **Example of Onboarding Extension Request:**
392
+ ```json
393
+ {
394
+ "type" : " ONBOARDING" ,
395
+ "reason" : " string" , // optional
396
+ "newEndsOn" : " number"
397
+ }
398
+ ```
399
+ - **Success Response of Onboarding Extension Request:**
400
+
401
+ - **Code:** 200
402
+ - **Content:**
403
+ ```json
404
+ {
405
+ "message" : " Request updated successfully" ,
406
+ "data" : {
407
+ "id" : " string" ,
408
+ "newEndsOn" : " number"
409
+ "updatedAt" : " number" ,
410
+ "type" : " ONBOARDING" ,
411
+ "lastModifiedBy" : " string" ,
412
+ "reason" : " string"
413
+ }
414
+ }
415
+ ```
416
+
417
+ - **Error Responses of Onboarding Extension Request:**
418
+ - **Code:** 400
419
+ - **Content:** `{ "statusCode": 400, "error": "Bad Request", "message": "Invalid type" }`
420
+ - **Code:** 400
421
+ - **Content:** `{ "statusCode": 400, "error": "Bad Request", "message": "Invalid request" }`
422
+ - **Code:** 400
423
+ - **Content:** `{ "statusCode": 400, "error": "Bad Request", "message": "Invalid request type" }`
424
+ - **Code:** 400
425
+ - **Content:** `{ "statusCode": 400, "error": "Bad Request", "message": "Only pending extension request can be updated" }`
426
+ - **Code:** 400
427
+ - **Content:** `{ "statusCode": 400, "error": "Bad Request", "message": "New deadline of the request must be greater than old deadline" }`
428
+ - **Code:** 403
429
+ - **Content:** `{ "statusCode": 403, "error": "Forbidden", "message": "Unauthorized to update request" }`
430
+ - **Code:** 404
431
+ - **Content:** `{ "statusCode": 404, "error": "Not Found", "message": "Request does not exist" }`
432
+ - **Code:** 500
433
+ - **Content:** `{ "statusCode": 500, "error": "Internal Server Error", "message": "An internal server error occurred" }`
434
+ - **Code:** 401
435
+ - **Content:** `{ "statusCode": 401, "error": "Unauthorized", "message": "Unauthenticated User" }`
436
+
437
+ #### Authentication and Authorization:
438
+
439
+ - Authentication is required for accessing this endpoint.
440
+
362
441
## Conclusion
363
442
364
443
The Requests API contract provides detailed information about the available routes, request and response structures, query parameters, headers, cookies, error handling, and authentication and authorization requirements. It also includes additional notes for each endpoint to provide further context and guidance. This contract serves as a comprehensive reference for developers who need to interact with the Requests API.
0 commit comments