com.evotext.clever.util.Caller Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clever-java Show documentation
Show all versions of clever-java Show documentation
The Clever-Java project is a Java wrapper for the Clever.com API for keeping educational applications rostered and up-to-date.
package com.evotext.clever.util;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.evotext.clever.model.Teacher;
import com.evotext.clever.requests.IdListRequest;
import com.evotext.clever.requests.ListRequest;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class Caller {
public static List getTeachers(final Clever clever) throws JsonParseException, JsonMappingException, IOException, JSONException
{
String url = clever.getFullUrl() + "teachers";
ListRequest request = new ListRequest.Builder(clever.getToken(), url).build();
JSONObject jo = Connect.get(request);
JSONArray arrJson= jo.getJSONArray("data");
ObjectMapper mapper = new ObjectMapper();
List list = new ArrayList<>();
for(int i=0;i getDataList(final Clever clever, final String url) throws JSONException, JsonParseException, JsonMappingException, IOException
{
ListRequest request = new ListRequest.Builder(clever.getToken(), url).build();
JSONObject jo = Connect.get(request);
System.out.println(jo);
JSONArray arrJson= jo.getJSONArray("data");
ObjectMapper mapper = new ObjectMapper();
Class clazz = clever.getBase().getClass();
List list = new ArrayList<>();
for(int i=0;i