NextSchoolNextSchool Data API

Query Home Visit

Fetch home-visit records — list, stats, and latest nested on Student

Query Home Visit for One Student

Returns the latest visit with all info sections, problem flags, relatives, and file attachments.

curl -X POST https://data.nextschool.io/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "query": "{ student(id: 12345) { id fullName visit { id overall overallText visitedAt infoOpinion { studyAssist drug violence electronic remark } problemFlags { anyFlag } files { id path kind } } } }"
  }'
const response = await fetch('https://data.nextschool.io/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${accessToken}`
  },
  body: JSON.stringify({
    query: `{
      student(id: 12345) {
        id
        fullName
        visit {
          id
          overall
          overallText
          visitedAt
          infoOpinion {
            studyAssist
            drug
            violence
            electronic
            remark
          }
          problemFlags {
            anyFlag
          }
          files {
            id
            path
            kind
          }
        }
      }
    }`
  })
});
const { data } = await response.json();
console.log(data.student.visit);
response = requests.post('https://data.nextschool.io/',
    headers={
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {access_token}'
    },
    json={
        'query': '''{
            student(id: 12345) {
                id
                fullName
                visit {
                    id
                    overall
                    overallText
                    visitedAt
                    infoOpinion {
                        studyAssist
                        drug
                        violence
                        electronic
                        remark
                    }
                    problemFlags {
                        anyFlag
                    }
                    files {
                        id
                        path
                        kind
                    }
                }
            }
        }'''
    }
)
visit = response.json()['data']['student']['visit']
<?php
$ch = curl_init('https://data.nextschool.io/');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        "Authorization: Bearer $accessToken"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'query' => '{ student(id: 12345) { id fullName visit { id overall overallText visitedAt infoOpinion { studyAssist drug violence electronic remark } problemFlags { anyFlag } files { id path kind } } } }'
    ]),
    CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
$visit = $result['data']['student']['visit'];
body, _ := json.Marshal(map[string]string{
    "query": `{ student(id: 12345) { id fullName visit { id overall overallText visitedAt infoOpinion { studyAssist drug violence electronic remark } problemFlags { anyFlag } files { id path kind } } } }`,
})
req, _ := http.NewRequest("POST", "https://data.nextschool.io/", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+accessToken)
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()

var result map[string]any
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["data"])
let resp = client.post("https://data.nextschool.io/")
    .header("Content-Type", "application/json")
    .header("Authorization", format!("Bearer {}", access_token))
    .json(&serde_json::json!({
        "query": "{ student(id: 12345) { id fullName visit { id overall overallText visitedAt infoOpinion { studyAssist drug violence electronic remark } problemFlags { anyFlag } files { id path kind } } } }"
    }))
    .send().await?
    .json::<serde_json::Value>().await?;

println!("{:#}", resp["data"]["student"]["visit"]);

Query Visit Student List

List students in a classroom with their home-visit status.

curl -X POST https://data.nextschool.io/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "query": "{ visitStudents(classroomId: 42, status: \"problem\", limit: 20) { studentId code firstname lastname classroomName visitId visitedAt overall overallText } }"
  }'
const response = await fetch('https://data.nextschool.io/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${accessToken}`
  },
  body: JSON.stringify({
    query: `{
      visitStudents(classroomId: 42, status: "problem", limit: 20) {
        studentId
        code
        firstname
        lastname
        classroomName
        visitId
        visitedAt
        overall
        overallText
      }
    }`
  })
});
const { data } = await response.json();
console.log(data.visitStudents);
response = requests.post('https://data.nextschool.io/',
    headers={
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {access_token}'
    },
    json={
        'query': '''{
            visitStudents(classroomId: 42, status: "problem", limit: 20) {
                studentId
                code
                firstname
                lastname
                classroomName
                visitId
                visitedAt
                overall
                overallText
            }
        }'''
    }
)
students = response.json()['data']['visitStudents']
<?php
$ch = curl_init('https://data.nextschool.io/');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        "Authorization: Bearer $accessToken"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'query' => '{ visitStudents(classroomId: 42, status: "problem", limit: 20) { studentId code firstname lastname classroomName visitId visitedAt overall overallText } }'
    ]),
    CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
$students = $result['data']['visitStudents'];
body, _ := json.Marshal(map[string]string{
    "query": `{ visitStudents(classroomId: 42, status: "problem", limit: 20) { studentId code firstname lastname classroomName visitId visitedAt overall overallText } }`,
})
req, _ := http.NewRequest("POST", "https://data.nextschool.io/", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+accessToken)
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()

var result map[string]any
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["data"])
let resp = client.post("https://data.nextschool.io/")
    .header("Content-Type", "application/json")
    .header("Authorization", format!("Bearer {}", access_token))
    .json(&serde_json::json!({
        "query": "{ visitStudents(classroomId: 42, status: \"problem\", limit: 20) { studentId code firstname lastname classroomName visitId visitedAt overall overallText } }"
    }))
    .send().await?
    .json::<serde_json::Value>().await?;

println!("{:#}", resp["data"]["visitStudents"]);

Query Visit Stats

Aggregate visit counts for the caller's school.

curl -X POST https://data.nextschool.io/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "query": "{ visitStats { total visited notVisited problem normal } }"
  }'
const response = await fetch('https://data.nextschool.io/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${accessToken}`
  },
  body: JSON.stringify({
    query: `{ visitStats { total visited notVisited problem normal } }`
  })
});
const { data } = await response.json();
console.log(data.visitStats);
response = requests.post('https://data.nextschool.io/',
    headers={
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {access_token}'
    },
    json={
        'query': '{ visitStats { total visited notVisited problem normal } }'
    }
)
stats = response.json()['data']['visitStats']
<?php
$ch = curl_init('https://data.nextschool.io/');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        "Authorization: Bearer $accessToken"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'query' => '{ visitStats { total visited notVisited problem normal } }'
    ]),
    CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
$stats = $result['data']['visitStats'];
body, _ := json.Marshal(map[string]string{
    "query": `{ visitStats { total visited notVisited problem normal } }`,
})
req, _ := http.NewRequest("POST", "https://data.nextschool.io/", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+accessToken)
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()

var result map[string]any
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["data"])
let resp = client.post("https://data.nextschool.io/")
    .header("Content-Type", "application/json")
    .header("Authorization", format!("Bearer {}", access_token))
    .json(&serde_json::json!({
        "query": "{ visitStats { total visited notVisited problem normal } }"
    }))
    .send().await?
    .json::<serde_json::Value>().await?;

println!("{:#}", resp["data"]["visitStats"]);

On this page