POST /api/v1/classes/{classId}/students/{studentCode}/pointsGET /api/v1/classes/{classId}/students/{studentCode}curl -X POST \
"https://growndcard.com/api/v1/classes/YOUR_CLASS_ID/students/2/points" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"type": "reward",
"points": 10,
"description": "퀴즈 정답"
}'curl -X GET \
"https://growndcard.com/api/v1/classes/YOUR_CLASS_ID/students/2" \
-H "X-API-Key: YOUR_API_KEY"X-API-Key: sk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6const fetch = require('node-fetch');
const API_KEY = 'sk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p4';
const BASE_URL = 'https://growndcard.com';
const CLASS_ID = 'NP0hetJ3wyQKFtRnFeftmPiy8Dl4_2';
// 포인트 부여
async function awardPoints(studentCode, points, description) {
const response = await fetch(
`${BASE_URL}/api/v1/classes/${CLASS_ID}/students/${studentCode}/points`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': API_KEY
},
body: JSON.stringify({
type: 'reward',
points,
description,
source: 'MyApp'
})
}
);
return await response.json();
}
// 학생 정보 조회
async function getStudentInfo(studentCode) {
const response = await fetch(
`${BASE_URL}/api/v1/classes/${CLASS_ID}/students/${studentCode}`,
{
method: 'GET',
headers: {
'X-API-Key': API_KEY
}
}
);
return await response.json();
}
// 사용 예시
async function main() {
try {
// 1. 포인트 부여
const awardResult = await awardPoints(2, 10, '퀴즈 정답');
console.log('포인트 부여 성공:', awardResult.data.totalPoints);
// 2. 학생 정보 조회
const student = await getStudentInfo(2);
console.log('학생:', student.data.studentName);
console.log('총 포인트:', student.data.points.totalPoints);
console.log('레벨:', student.data.points.currentLevel);
if (student.data.dragon) {
console.log('드래곤:', student.data.dragon.name);
console.log('드래곤 레벨:', student.data.dragon.absoluteLevel);
}
} catch (error) {
console.error('에러:', error);
}
}
main();import requests
API_KEY = 'sk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p4'
BASE_URL = 'https://growndcard.com'
CLASS_ID = 'NP0hetJ3wyQKFtRnFeftmPiy8Dl4_2'
def award_points(student_code, points, description):
"""포인트 부여"""
url = f'{BASE_URL}/api/v1/classes/{CLASS_ID}/students/{student_code}/points'
response = requests.post(
url,
headers={
'Content-Type': 'application/json',
'X-API-Key': API_KEY
},
json={
'type': 'reward',
'points': points,
'description': description,
'source': 'MyApp'
}
)
return response.json()
def get_student_info(student_code):
"""학생 정보 조회"""
url = f'{BASE_URL}/api/v1/classes/{CLASS_ID}/students/{student_code}'
response = requests.get(
url,
headers={'X-API-Key': API_KEY}
)
return response.json()
# 사용 예시
if __name__ == '__main__':
# 1. 포인트 부여
award_result = award_points(2, 10, '퀴즈 정답')
print(f"포인트 부여 성공: {award_result['data']['totalPoints']}")
# 2. 학생 정보 조회
student = get_student_info(2)
print(f"학생: {student['data']['studentName']}")
print(f"총 포인트: {student['data']['points']['totalPoints']}")
print(f"레벨: {student['data']['points']['currentLevel']}")
if student['data']['dragon']:
print(f"드래곤: {student['data']['dragon'].get('name', '이름 없음')}")
print(f"드래곤 레벨: {student['data']['dragon']['absoluteLevel']}")