Employer Endpoints

Job Management

Create Job

  • Endpoint: POST /create-jobs

  • Description: Create a new job listing. Only employers can create jobs.

  • Headers Required:

    • Authorization: Bearer <access_token>

  • Request (JSON):

    {
      "title": "Software Developer",
      "company_name": "TechCorp Inc.",
      "location": "Remote",
      "job_type": "Full-time",
      "industry": "Technology",
      "experience": "Mid-level",
      "description": "We are looking for a skilled software developer...",
      "skill_1": "JavaScript",
      "skill_2": "React",
      "skill_3": "Node.js",
      "skill_4": "MongoDB",
      "skill_5": "Git",
      "pwd_friendly": true,
      "min_salary": 50000.0,
      "max_salary": 80000.0
    }
  • Sample Request (curl):

    curl -X POST "http://your-api-url/create-jobs" \
      -H "Authorization: Bearer <access_token>" \
      -H "Content-Type: application/json" \
      -d '{
        "title": "Software Developer",
        "company_name": "TechCorp Inc.",
        "location": "Remote",
        "job_type": "Full-time",
        "industry": "Technology",
        "experience": "Mid-level",
        "description": "We are looking for a skilled software developer...",
        "skill_1": "JavaScript",
        "skill_2": "React",
        "skill_3": "Node.js",
        "skill_4": "MongoDB",
        "skill_5": "Git",
        "pwd_friendly": true,
        "min_salary": 50000.0,
        "max_salary": 80000.0
      }'
  • Sample Response:

    {
      "Status": "Sucessfull",
      "Message": "Job has been created",
      "Details": "data=[{id: 8, user_id: '148cc1c6-2e81-4037-913c-7617564baa33', title: 'Software Developer', job_description: 'We are looking for...', skill_1: 'JavaScript', skill_2: 'React', skill_3: 'Node.js', skill_4: 'MongoDB', skill_5: 'Git', pwd_friendly: True, created_at: '2025-06-04T06:23:51.104274+00:00'}] count=None"
    }
  • Web Implementation (JavaScript):

    const createJob = async (jobData) => {
      try {
        const token = localStorage.getItem('sessionKey');
        
        const response = await fetch('http://your-api-url/create-jobs', {
          method: 'POST',
          headers: {
            'Authorization': `Bearer ${token}`,
            'Content-Type': 'application/json'
          },
          body: JSON.stringify(jobData)
        });
        
        const data = await response.json();
        
        if (data.Status === 'Sucessfull') {
          return data;
        } else {
          throw new Error(data.Message);
        }
      } catch (error) {
        console.error('Job creation error:', error);
        throw error;
      }
    };

View All Jobs

  • Endpoint: GET /view-all-jobs

  • Description: Get all job listings created by the current employer.

  • Headers Required:

    • Authorization: Bearer <access_token>

  • Request: No body required

  • Sample Request (curl):

    curl -X GET "http://your-api-url/view-all-jobs" \
      -H "Authorization: Bearer <access_token>"
  • Sample Response:

    {
      "jobs": [
        {
          "id": 11,
          "user_id": "148cc1c6-2e81-4037-913c-7617564baa33",
          "title": "Content Writer",
          "job_description": "Create engaging content for our blog",
          "skill_1": "SEO",
          "skill_2": "Copywriting",
          "skill_3": "Grammar",
          "skill_4": "WordPress",
          "skill_5": "Research",
          "pwd_friendly": true,
          "created_at": "2025-06-05T12:39:57.008087+00:00",
          "company_name": "ContentCorp",
          "location": "Remote",
          "job_type": "Part-time",
          "industry": "Marketing",
          "experience": "Entry Level",
          "min_salary": 7000.0,
          "max_salary": 8000.0
        }
      ]
    }
  • Web Implementation:

    const getAllJobs = async () => {
      try {
        const token = localStorage.getItem('sessionKey');
        
        const response = await fetch('http://your-api-url/view-all-jobs', {
          method: 'GET',
          headers: {
            'Authorization': `Bearer ${token}`,
            'Content-Type': 'application/json'
          }
        });
        
        const data = await response.json();
        
        if (data.jobs) {
          return data.jobs;
        } else {
          throw new Error(data.Message || 'No jobs found');
        }
      } catch (error) {
        console.error('Jobs fetch error:', error);
        throw error;
      }
    };

View Specific Job

  • Endpoint: GET /view-job/{id}

  • Description: Get details of a specific job listing.

  • Parameters:

    • id (path parameter, required) - The ID of the job

  • Request: No body required

  • Sample Response:

    {
      "Status": "Successfull",
      "Message": "Job Number 16 Found",
      "Details": [
        {
          "id": 16,
          "user_id": "148cc1c6-2e81-4037-913c-7617564baa33",
          "title": "Housekeeper",
          "job_description": "Part-time housekeeping position",
          "skill_1": "Cleaning Techniques",
          "skill_2": "Attention to Detail",
          "skill_3": "Time Management",
          "skill_4": "Safety Practices",
          "skill_5": "Organization",
          "pwd_friendly": true,
          "created_at": "2025-06-05T13:24:32.405627+00:00",
          "company_name": "CleanCorp",
          "location": "Local",
          "job_type": "Part-time",
          "industry": "Services",
          "experience": "Entry Level",
          "min_salary": 800.0,
          "max_salary": 1000.0
        }
      ]
    }

Update Job

  • Endpoint: POST /update-job/{id}

  • Description: Update an existing job listing.

  • Headers Required:

    • Authorization: Bearer <access_token>

  • Parameters:

    • id (path parameter, required) - The ID of the job to update

  • Request: Same JSON structure as create job

  • Sample Request (curl):

    curl -X POST "http://your-api-url/update-job/16" \
      -H "Authorization: Bearer <access_token>" \
      -H "Content-Type: application/json" \
      -d '{
        "title": "Senior Housekeeper",
        "company_name": "CleanCorp",
        "location": "Local",
        "job_type": "Full-time",
        "industry": "Services",
        "experience": "Mid-level",
        "description": "Senior housekeeping position with team leadership",
        "skill_1": "Cleaning Techniques",
        "skill_2": "Team Leadership",
        "skill_3": "Time Management",
        "skill_4": "Safety Practices",
        "skill_5": "Organization",
        "pwd_friendly": true,
        "min_salary": 1200.0,
        "max_salary": 1500.0
      }'

Delete Job

  • Endpoint: POST /delete-job/{id}

  • Description: Delete a job listing.

  • Headers Required:

    • Authorization: Bearer <access_token>

  • Parameters:

    • id (path parameter, required) - The ID of the job to delete

  • Request: No body required

  • Sample Request (curl):

    curl -X POST "http://your-api-url/delete-job/16" \
      -H "Authorization: Bearer <access_token>"

Application Management

View Job Applicants

  • Endpoint: GET /job/{job_id}/applicants

  • Description: Get all applicants for a specific job listing.

  • Headers Required:

    • Authorization: Bearer <access_token>

  • Parameters:

    • job_id (path parameter, required) - The ID of the job

  • Request: No body required

  • Sample Request (curl):

    curl -X GET "http://your-api-url/job/16/applicants" \
      -H "Authorization: Bearer <access_token>"
  • Sample Response:

    {
      "Status": "Successfull",
      "Applicants": [
        {
          "id": 1,
          "user_id": "f9b86db6-93dc-4e29-a1be-6dfcb114b8f7",
          "job_id": 16,
          "status": "under_review",
          "created_at": "2025-06-05T14:13:35.947101+00:00"
        }
      ]
    }
  • Web Implementation:

    const getJobApplicants = async (jobId) => {
      try {
        const token = localStorage.getItem('sessionKey');
        
        const response = await fetch(`http://your-api-url/job/${jobId}/applicants`, {
          method: 'GET',
          headers: {
            'Authorization': `Bearer ${token}`,
            'Content-Type': 'application/json'
          }
        });
        
        const data = await response.json();
        
        if (data.Status === 'Successfull') {
          return data.Applicants;
        } else {
          throw new Error(data.Message);
        }
      } catch (error) {
        console.error('Applicants fetch error:', error);
        throw error;
      }
    };

Update Application Status

  • Endpoint: PATCH /application/{id}/status

  • Description: Update the status of a job application (e.g., accepted, rejected, under_review).

  • Headers Required:

    • Authorization: Bearer <access_token>

  • Parameters:

    • id (path parameter, required) - The ID of the application

    • new_status (query parameter, required) - The new status ('under_review', 'accepted', 'rejected')

  • Sample Request (curl):

    curl -X PATCH "http://your-api-url/application/1/status?new_status=accepted" \
      -H "Authorization: Bearer <access_token>"
  • Sample Response:

    {
      "Status": "Successfull",
      "Applicants": [
        {
          "id": 1,
          "user_id": "f9b86db6-93dc-4e29-a1be-6dfcb114b8f7",
          "job_id": 16,
          "status": "accepted",
          "created_at": "2025-06-05T14:13:35.947101+00:00"
        }
      ]
    }
  • Web Implementation:

    const updateApplicationStatus = async (applicationId, newStatus) => {
      try {
        const token = localStorage.getItem('sessionKey');
        
        const response = await fetch(`http://your-api-url/application/${applicationId}/status?new_status=${newStatus}`, {
          method: 'PATCH',
          headers: {
            'Authorization': `Bearer ${token}`,
            'Content-Type': 'application/json'
          }
        });
        
        const data = await response.json();
        
        if (data.Status === 'Successfull') {
          return data;
        } else {
          throw new Error(data.Message);
        }
      } catch (error) {
        console.error('Status update error:', error);
        throw error;
      }
    };

Last updated