Skip to main content

Endpoint

GET /api/method/ion_career.api.get_job_questions

Description

Retrieves all questions from the Job Question Set associated with a specific Job Opening. This endpoint is used to dynamically render job application forms with custom questions.

Parameters

job_opening
string
required
The name/ID of the Job Opening document

Response

Returns an array of question objects:
message
array
Array of question objects

Example Request

import frappe

questions = frappe.call(
    "ion_career.api.get_job_questions",
    job_opening="Software Engineer - 2024"
)

for q in questions:
    print(f"{q['question']} - Required: {q['required']}")

Example Response

{
  "message": [
    {
      "question": "Do you have 5+ years of Python experience?",
      "fieldname": "python_experience",
      "input_type": "Select",
      "required": 1
    },
    {
      "question": "Are you authorized to work in the US?",
      "fieldname": "work_authorization",
      "input_type": "Checkbox",
      "required": 1
    },
    {
      "question": "Do you have experience with Frappe Framework?",
      "fieldname": "frappe_experience",
      "input_type": "Select",
      "required": 0
    }
  ]
}

Implementation

The source code for this endpoint:
import frappe

@frappe.whitelist()
def get_job_questions(job_opening):
    jo = frappe.get_doc("Job Opening", job_opening)

    qset_name = jo.custom_job_question_set
    if not qset_name:
        return []

    qset = frappe.get_doc("Job Question Set", qset_name)

    return [{
        "question": q.question,
        "fieldname": q.fieldname,
        "input_type": q.input_type,
        "required": q.required
    } for q in qset.questions]

Behavior

  • If the Job Opening has no associated Job Question Set, returns an empty array []
  • Questions are returned in the order defined in the Job Question Set
  • The endpoint is whitelisted and accessible via REST API

Build docs developers (and LLMs) love