Loopwise Docs
Guides

Zapier Quickstart

This guide will get you all set up and ready to use the Loopwise API with Zapier. We'll cover how to authenticate and make your first API request.

All endpoints require authentication with an API key. You can obtain the API key from your school's integration settings in the Zapier dashboard.

Me

Get the name of the school associated with the API key.

cURL
curl -X GET \
    -H "Authorization: Bearer {api_key}" \
    https://yourdomain.com/api/v1/zapiers/me
Ruby
require 'uri'
require 'net/http'

url = URI("https://yourdomain.com/api/v1/zapiers/me")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer {api_key}"

response = https.request(request)
puts response.read_body

Enroll Course

Get a list of StudentCourseShip records for courses belonging to the school that were created in the past 30 minutes.

cURL
curl -G https://kaik.io/v1/api/v1/zapiers/enroll_course \
  -H "Authorization: Bearer {token}"
Ruby
require 'net/http'
require 'uri'

url = URI('https://kaik.io/v1/api/v1/zapiers/enroll_course')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['Authorization'] = 'Bearer {token}'

response = http.request(request)
puts response.read_body
// Response
// Status: 200 OK
// Body:
[
  {
    "id": "b20784f1-e0d1-46c8-ba6b-9e2d3266da23",
    "course": {
      "id": "b051c891-9201-4056-a7b9-2e28c23cbfbf",
      "name": "Math",
      "slug": "math",
      "subtitle": "Introduction to Math",
      "description": "This course provides an introduction to mathematics for beginners."
    },
    "user": {
      "name": "John Doe",
      "email": "johndoe@example.com",
      "phone_number": "1234567890"
    }
  },
  {
    "id": "cecf1c7b-5a8e-41d2-ae5c-846fb7bfc404",
    "course": {
      "id": "534456eb-1b70-4d4d-90f6-7f0575c21ac9",
      "name": "English",
      "slug": "english",
      "subtitle": "Introduction to English",
      "description": "This course provides an introduction to English for beginners."
    },
    "user": {
      "name": "Jane Doe",
      "email": "janedoe@example.com",
      "phone_number": "1234567890"
    }
  }
]

New User

Get a list of User records for students belonging to the school that were created in the past 30 minutes.

cURL
curl -G https://kaik.io/v1/api/v1/zapiers/new_user \
  -H "Authorization: Bearer {token}"
Ruby
require 'net/http'
require 'uri'
require 'json'

uri = URI('https://kaik.io/v1/api/v1/zapiers/new_user')

request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer {token}'

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
// Response
// Status: 200 OK
// Body:
[
  {
    "id": "b20784f1-e0d1-46c8-ba6b-9e2d3266da23",
    "name": "John Doe",
    "email": "johndoe@example.com",
    "phone_number": "1234567890"
  },
  {
    "id": "cecf1c7b-5a8e-41d2-ae5c-846fb7bfc404",
    "name": "Jane Doe",
    "email": "janedoe@example.com",
    "phone_number": "1234567890"
  }
]

New Transaction

Get a list of Payment records for payments belonging to the school that were paid in the past 30 minutes.

cURL
curl -G https://kaik.io/api/v1/zapiers/new_transaction \
  -H "Authorization: Bearer {token}"
Ruby
require 'uri'
require 'net/http'

url = URI("https://kaik.io/api/v1/zapiers/new_transaction")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer {token}"

response = http.request(request)
puts response.read_body
// Response
// Status: 200 OK
// Body:
[
  {
    "id": "b20784f1-e0d1-46c8-ba6b-9e2d3266da23",
    "trade_no": "TRADE20220420123456",
    "currency": "TWD",
    "amount": 5000.0,
    "user": {
      "name": "John Doe",
      "email": "johndoe@example.com",
      "phone_number": "1234567890"
    }
  },
  {
    "id": "cecf1c7b-5a8e-41d2-ae5c-846fb7bfc404",
    "trade_no": "TRADE20220420123457",
    "currency": "USD",
    "amount": 100.0,
    "user": {
      "name": "Jane Doe",
      "email": "janedoe@example.com",
      "phone_number": "1234567890"
    }
  }
]

New Comment

Get a list of Comment records for comments belonging to the school that were created in the past 30 minutes.

cURL
curl -G https://kaik.io/api/v1/zapiers/new_comment \
  -H "Authorization: Bearer {token}"
Ruby
require 'net/http'

uri = URI('https://kaik.io/api/v1/zapiers/new_comment')

req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer {token}'

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(req)
end

puts res.code
puts res.body
// Response
// Status: 200 OK
// Body:
[
  {
    "id": "b20784f1-e0d1-46c8-ba6b-9e2d3266da23",
    "content": "This is a comment.",
    "created_at": "2023-04-20T09:30:00.000Z",
    "user": {
      "name": "John Doe",
      "email": "johndoe@example.com",
      "phone_number": "1234567890"
    }
  },
  {
    "id": "cecf1c7b-5a8e-41d2-ae5c-846fb7bfc404",
    "content": "This is another comment.",
    "created_at": "2023-04-20T09:35:00.000Z",
    "user": {
      "name": "Jane Doe",
      "email": "janedoe@example.com",
      "phone_number": "1234567890"
    }
  }
]

On this page