This document describes all REST APIs implemented so far in the ShramikConnect .NET Web API backend.
The system supports multi-role users, job posting, applications, contracts, and admin management.
Important
Authentication: Currently uses a temporary X-User-Id header for development. JWT-based authorization will replace this in the next phase.
Creates a new user account (Worker / Client / Organization).
- Method:
POST - Endpoint:
/api/auth/register - Request Body:
{ "fullName": "John Doe", "email": "john@example.com", "phone": "9876543210", "password": "Strong@123", "role": 2 } - Notes: * Admin & Supervisor cannot self-register.
- Password is securely hashed.
- Profile is created later via profile APIs.
Authenticates user and returns JWT (and user info).
- Method:
POST - Endpoint:
/api/auth/login
Used to update role-specific profile details after account creation.
| Action | Method | Endpoint |
|---|---|---|
| Update Worker Profile | PUT |
/api/profile/worker |
| Update Client Profile | PUT |
/api/profile/client |
| Update Organization Profile | PUT |
/api/profile/organization |
Notes:
- Profiles are updated (not recreated).
- No duplicate profile rows are created.
Accessible to Admin role only.
- Get All Users:
GET /api/admin/users - Get User by ID:
GET /api/admin/users/{userId} - Update User (Core Info):
PUT /api/admin/users/{userId}- Editable Fields: Full name, Phone, Active status.
- Soft Delete User (Deactivate):
DELETE /api/admin/users/{userId}- Sets
IsActive = false. - Preserves all history and relations.
- Sets
- Hard Delete User (Permanent):
DELETE /api/admin/users/{userId}/hard- Deletes user and related profiles.
- Intended for test data or GDPR cases.
- Create Job:
POST /api/jobs - Get All Jobs:
GET /api/jobs - Get Job by ID:
GET /api/jobs/{jobId} - Get Jobs Posted by User:
GET /api/jobs/posted-by/{userId} - Get Jobs by Category:
GET /api/jobs/category/{category}- Example:
/api/jobs/category/Painting
- Example:
- Edit Job:
PUT /api/jobs/{jobId}(Only job owner can edit) - Toggle Job Status:
PATCH /api/jobs/{jobId}/toggle-status- Toggles between Open ↔ Closed.
- Job can be reopened or closed anytime; no deletion.
- Apply to Job (Worker):
POST /api/job-applications/apply - View Applicants (Client/Org):
GET /api/job-applications/job/{jobId} - Start Discussion:
PATCH /api/job-applications/{applicationId}/start-discussion- Marks application as
InProcess. - Enables chat & contract creation.
- Marks application as
- View My Applications (Worker):
GET /api/job-applications/my-applications - Withdraw Application (Worker):
PATCH /api/job-applications/{applicationId}/withdraw- Rules: Allowed only if status is
AppliedorInProcess. Not allowed after acceptance.
- Rules: Allowed only if status is
Contracts are created only after application enters discussion (InProcess).
- Create Contract:
POST /api/contracts - Update Contract Terms:
PUT /api/contracts/{contractId}(Client only – Pending status) - Get Contract by Job:
GET /api/contracts/job/{jobId} - Accept Contract (Worker):
PATCH /api/contracts/{contractId}/accept- Effects: Contract →
Accepted; Application →Accepted; Job →Closed; Other applications →Rejected.
- Effects: Contract →
- Reject Contract (Worker):
PATCH /api/contracts/{contractId}/reject
- Job Posted
- Worker Applies
- Client Starts Discussion (
InProcess) - Contract Created (
Pending) - Worker Accepts / Rejects
X-User-Id Header Used temporarily to simulate authentication.
- Key:
X-User-Id - Value Example:
5
Warning
This will be fully replaced by JWT claims in the next phase.