Skip to content

Commit dbfce30

Browse files
Reorganize Anteater API docs (#33)
* docs: ๐Ÿ“š๏ธ [api] api is maintained by a specifc arm of ICSSC * docs: ๐Ÿ“š๏ธ [api] redo "what is ICSSC" defer to club events page about event times, make some mildly opinionated tweaks * docs: ๐Ÿ“š๏ธ [api] link attribution from about * docs: ๐Ÿ“š๏ธ [api] tighten language about research data * docs: ๐Ÿ“š๏ธ [api] historical data info out of accordions, reword * docs: ๐Ÿ“š๏ธ [api] reword inviting non-projects people * docs: ๐Ÿ“š๏ธ [api] link to contributor docs will fill out said contributor docs * docs: ๐Ÿ“š๏ธ [api] import anteater-api/CONTRIBUTING.md * docs: ๐Ÿ“š๏ธ [api] mention docker compose is not strictly needed * docs: ๐Ÿ“š๏ธ [api] contrib guide clarity * docs: ๐Ÿ“š๏ธ [api] reorder contrib landing, language tweak * docs: ๐Ÿ“š๏ธ [api] about api at index.md * docs: ๐Ÿ“š๏ธ [api] move attribution to about section this requires chair approval * docs: ๐Ÿ“š๏ธ [api] fix 404 on dev landing * docs: ๐Ÿ“š๏ธ [api] add one linebreak * docs: ๐Ÿ“š๏ธ [api] link dev docs to about * docs: ๐Ÿ“š๏ธ [api] clarify anteater offers both rest and gql * docs: ๐Ÿ“š๏ธ [api] example of REST resource, whitespace * docs: ๐Ÿ“š๏ธ [api] clarify what gql is, whitespace * docs: ๐Ÿ“š๏ธ [api] new getting started page, move some content onto it * docs: ๐Ÿ“š๏ธ [api] finish dev getting started * docs: ๐Ÿ“š๏ธ [api] best practices -> "keys and limits" * docs: ๐Ÿ“š๏ธ [api] keys page whitespace * docs: ๐Ÿ“š๏ธ [api] grammar * docs: ๐Ÿ“š๏ธ [api] per-key ratelimit clarification * docs: ๐Ÿ“š๏ธ [api] how to use api keys also whitespace * docs: ๐Ÿ“š๏ธ [api] clarify requests is a python lib * docs: ๐Ÿ“š๏ธ [api] clarify in snippets any endpoint is ok * docs: ๐Ÿ“š๏ธ [api] as of node 18 importing fetch is unnecessary everywhere * docs: ๐Ÿ“š๏ธ [api] attribution policy back in dev docs sidebar * docs: ๐Ÿ“š๏ธ [api] state graphql url * docs: ๐Ÿ“š๏ธ [api] tighter language * docs: ๐Ÿ“š๏ธ [api] link to gh when we say FOSS how did we never do this before * docs: ๐Ÿ“š๏ธ [api] shorten contrib setup title * docs: ๐Ÿ“š๏ธ [api] use <Step> for contrib setup steps * docs: ๐Ÿ“š๏ธ [api] wording tweak * docs: ๐Ÿ“š๏ธ [api] page descriptions * docs: ๐Ÿ“š๏ธ [api] move attribution to developer category #33 (comment) * docs: ๐Ÿ“š๏ธ [api] title case in title * docs: ๐Ÿ“š๏ธ [api] description tweak
1 parent c65d091 commit dbfce30

File tree

10 files changed

+201
-66
lines changed

10 files changed

+201
-66
lines changed

โ€Žcontent/docs/about/anteaterapi.mdx

-50
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: Anteater API
3+
description: Basic information about Anteater API
4+
---
5+
6+
## What is Anteater API?
7+
8+
Anteater API provides various data from the University of California, Irvine, in a structured format that can be used by other software.
9+
10+
Anteater API is maintained by its team within the Projects Committee of the ICS Student Council (ICSSC).
11+
12+
## What is ICSSC?
13+
14+
ICS Student Council is a far-reaching organization that aims to improve student life within and beyond the Donald Bren School of Information and Computer Sciences.
15+
16+
Feel free to join us at our [events](https://icssc.club/events). All UCI affiliates are welcome.
17+
18+
Learn more about how you can get involved with us [here](https://icssc.club/get-involved).
19+
20+
## Using Anteater API in Your Software
21+
22+
If you're building an application that manipulates public data provided by the school, the Anteater API likely has you covered.
23+
24+
You can learn about the capabilities of Anteater API, and how to use it, [here](/docs/developer/anteaterapi).
25+
26+
Any use of Anteater API for any purpose is bound by the [attribution policy](/docs/developer/anteaterapi/attribution-policy).
27+
28+
## Using Anteater API for Research
29+
30+
Anteater API contains a wealth of historical data of potential research interest. The following is a non-exhaustive list of historical data we serve:
31+
32+
- **Schedule of Classes** for terms not earlier than fall 1990.
33+
- **Letter grade distributions** for course offerings not earlier than summer 2014.
34+
- **Course enrollment trends** for course sections held not earlier than winter 2022.
35+
36+
If there's more publicly available data that you'd like to see us provide for research, please don't hesitate to reach out.
37+
38+
## Contributing to Anteater API
39+
40+
Anteater API is free and open-source software (FOSS). The word "free" in this context is as in free speech, though there is also no monetary cost to use Anteater API. This means that everyone can view its [source code](https://github.com/icssc/anteater-api) to see how it works, and everyone is allowed to contribute to Anteater API and/or redistribute its source code.
41+
42+
For more information on contributing to Anteater API, see the [contributor section](/docs/contributor/anteaterapi) of the Anteater API documentation.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
---
22
title: Anteater API
33
---
4+
5+
To learn how to set up a development environment for Anteater API, see the [setup guide](/docs/contributor/anteaterapi/setup).
6+
7+
The Anteater API team may invite active contributors to join the team if they are not already part of the ICSSC Projects Committee.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: Setting Up
3+
description: How to set up a local Anteater API environment to contribute
4+
---
5+
6+
import { Step, Steps } from 'fumadocs-ui/components/steps';
7+
8+
Thank you for your interest in contributing to Anteater API!
9+
10+
## โœ… Getting Started
11+
12+
### ๐Ÿ› ๏ธ Prerequisites
13+
14+
- For Windows users: A [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) instance
15+
- A Node.js environment
16+
- [pnpm](https://pnpm.io/installation), a blazingly fast package manager for Node.js
17+
- [nvm](https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script), a version manager for Node.js
18+
- [Docker Compose](https://docs.docker.com/compose/install/) for running the local database server, or an already running PostgreSQL server
19+
- Optionally: [PostgreSQL](https://www.postgresql.org/download/) version 16, for generating database dumps
20+
21+
### ๐Ÿง‘โ€๐Ÿ’ป Setting Up
22+
23+
<Steps>
24+
25+
<Step>
26+
Clone the repository and change into it. In your command line:
27+
28+
```shell
29+
git clone [email protected]:icssc/anteater-api.git
30+
cd anteater-api
31+
```
32+
</Step>
33+
34+
<Step>
35+
Make a copy of the `.env.example`.
36+
37+
```shell
38+
cp .env.example .env
39+
```
40+
</Step>
41+
42+
<Step>
43+
Install the dependencies.
44+
45+
```shell
46+
pnpm i
47+
```
48+
</Step>
49+
50+
<Step>
51+
Download the latest version of the database dump [here](https://anteater-api-dump.s3.us-west-1.amazonaws.com/db.sql.gz), and move it into the `packages/db` directory.
52+
53+
_Optional_: Verify the integrity of the database dump.
54+
55+
To do this, download the checksum [here](https://anteater-api-dump.s3.us-west-1.amazonaws.com/db.sql.gz.sha256sum), move it into the `packages/db` directory, then run the following command:
56+
57+
```shell
58+
sha256sum -c db.sql.gz.sha256sum
59+
```
60+
61+
If the checksum does not match, the database dump may be corrupt or have been tampered with. You should delete it immediately and try downloading it again.
62+
</Step>
63+
64+
<Step>
65+
Start the local Postgres database. If you are using Docker Compose, as we recommend above, this is simple:
66+
67+
```shell
68+
docker-compose up -d
69+
```
70+
</Step>
71+
72+
<Step>
73+
Start the development server.
74+
75+
```shell
76+
pnpm dev
77+
```
78+
79+
The process of database seeding (importing data from the database dump) can take a while. If at first this fails, wait a few minutes before trying again.
80+
81+
The development server will automatically reload upon any changes to the codebase. This will aid in your testing.
82+
</Step>
83+
84+
</Steps>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: Getting Started
3+
description: What you need to do in order to start using Anteater API
4+
---
5+
6+
**This page is for Anteater API users. Potential contributors refer to the [Contributor Docs](/docs/contributor/anteaterapi).**
7+
8+
## REST or GraphQL?
9+
10+
The first choice you need to make when using Anteater API is between our REST API and our GraphQL API.
11+
The correct choice is dependent on your use case and, to some degree, on personal preference.
12+
It is akin to the choice of which programming language to use.
13+
14+
## Authorization
15+
16+
Unlike some other Web APIs, Anteater API does not require API keys or authentication, so you can start using this API immediately.
17+
However, there are still advantages to seeking an API key; learn how to obtain and use one [here](./keys-limits).
18+
19+
## Choosing your stack
20+
21+
If your application is not already fully set up to handle REST or GraphQL, you will need to add to your stack, the list of technologies powering your application.
22+
Examples of parts of your stack include your language (e.g. JavaScript), frameworks (e.g. React), and, most relevantly to Anteater API, your HTTP client.
23+
If using GraphQL, you may also want to select a specialized GraphQL client.
24+
25+
We have a guide on integrating our REST API with TypeScript [here](/docs/developer/anteaterapi/rest-api/guides/typescript-integration).
26+
27+
## Attribution
28+
29+
If you use Anteater API, you **must** follow the [Attribution Policy](./attribution-policy).
30+
31+
## Reading documentation
32+
33+
Finally, read the API reference for [REST](https://anteaterapi.com/reference) or try the [GraphQL Sandbox](https://studio.apollographql.com/sandbox/explorer?endpoint=https://anteaterapi.com/v2/graphql).
34+
Both provide exhaustive documentation of what Anteater API offers.
35+
36+
Have fun!

โ€Žcontent/docs/developer/anteaterapi/graphql-api/index.md โ€Žcontent/docs/developer/anteaterapi/graphql-api/index.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ title: GraphQL API
33
---
44

55
The GraphQL API allows for access to the same resources that can be accessed through the REST API.
6+
The current URL is https://anteaterapi.com/v2/graphql.
67

78
You can try using the GraphQL API through [Apollo Sandbox](https://studio.apollographql.com/sandbox/explorer?endpoint=https://anteaterapi.com/v2/graphql) (also available through the navbar), which is a lightweight web-based IDE for GraphQL queries. The Sandbox also contains up-to-date documentation on the different queries available, so you can develop and test all of your queries from within a single page.

โ€Žcontent/docs/developer/anteaterapi/index.mdx

+12-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
66

77
Anteater API is an API maintained by ICSSC Projects that provides various UCI related data. All the data served through Anteater API is publicly accessible, or derived from historically publicly accessible data. If you use data obtained though Anteater API in your project, please give us credit in accordance with our [Attribution Policy](/docs/developer/anteaterapi/attribution-policy).
88

9-
You are currently reading the **Developer Docs** for Anteater API. This part of the documentation covers how to properly integrate Anteater API into your own projects. If you're a developer who's interested in helping to improve Anteater API, please refer to the Anteater API [Contributor Docs](/docs/contributor/anteaterapi/getting-started-contributor).
9+
You are currently reading the **Developer Docs** for Anteater API. This part of the documentation covers how to properly integrate Anteater API into your own projects.
10+
If you're a developer who's interested in helping to improve Anteater API, please refer to the Anteater API [Contributor Docs](/docs/contributor/anteaterapi/).
11+
For general introductory information about Anteater API, see the [About Docs](/docs/about/anteaterapi).
1012

1113
## FAQ
1214

@@ -18,15 +20,21 @@ You are currently reading the **Developer Docs** for Anteater API. This part of
1820

1921
</Accordion>
2022
<Accordion title="What is the difference between REST and GraphQL?">
21-
REST stands for **RE**presentational **S**tate **T**ransfer. A REST API has endpoints, each of which represents a resource. When a request is made to an endpoint, the server responds with a representation of the state of the resource, hence the name. Each HTTP verb (`GET`, `POST`, etc.) represents a different action on the resource being requested.
23+
Anteater API offers both a REST API and a GraphQL API.
2224

23-
GraphQL is a query language for APIs. It is more flexible than REST, since you can query multiple endpoints in the same request, and also include only fields from the endpoint(s) that are relevant. However, it does have a slightly higher learning curve, and may require additional work to integrate into your application.
25+
REST stands for **RE**presentational **S**tate **T**ransfer. A REST API has endpoints, each of which represents a resource (e.g. which week of school a certain date is in).
26+
When a request is made to an endpoint, the server responds with a representation of the state of the resource (e.g. week 4 of winter), hence the name.
27+
Each HTTP verb (`GET`, `POST`, etc.) represents a different action on the resource being requested.
28+
29+
GraphQL is a query language for APIs. It is more flexible than REST, since you can query multiple endpoints in the same request and/or selected parts of the data (e.g. when the schedule of classes is posted for a quarter instead of all the important dates).
30+
However, it does have a slightly higher learning curve, and may require additional work to integrate into your application.
2431

2532
The correct API to use will almost always depend on your use case; there is no single correct answer.
2633

2734
</Accordion>
2835
<Accordion title="How do I start using Anteater API?">
29-
Unlike some other Web APIs, Anteater API does not require API keys or authentication, so you can start using this API immediately. However, in order to ensure a good experience for all users of the API, we ask that you read and abide by the [Attribution Policy](attribution-policy).
36+
Take a look at the [Getting Started](./anteaterapi/getting-started) page.
37+
In order to ensure a good experience for all users of the API, we ask that you read and abide by the [Attribution Policy](/docs/developer/anteaterapi/attribution-policy).
3038

3139
</Accordion>
3240
</Accordions>

โ€Žcontent/docs/developer/anteaterapi/best-practices.mdx โ€Žcontent/docs/developer/anteaterapi/keys-limits.mdx

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
---
2-
title: Best Practices
2+
title: Keys and Ratelimits
3+
description: The ratelimits on Anteater API and how to obtain and use an API key
34
---
45

56
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
67

78
## Rate Limits
89

9-
You may use most features of Anteater API without requesting an API key. Requests made without keys are subject to a per-IP basis and also draws from a global quota that is replenished on an hourly basis. If the global quota is exhausted, only requests with valid API keys will be accepted, so we recommend that you request an API key [here](https://dashboard.anteaterapi.com).
10+
You may use most features of Anteater API without requesting an API key.
11+
Requests made without keys are ratelimited on a per-IP basis and also draw from a global quota that is replenished on an hourly basis.
12+
If the global quota is exhausted, only requests with valid API keys will be accepted, so we recommend that you request an API key [here](https://dashboard.anteaterapi.com).
1013

11-
Rate limits for Anteater API are enforced on a per-key basis otherwise. However, our goal with these rate limits is to support almost all applications while preventing abuse. We understand that student projects, especially those made for a hackathon, may experience sudden traffic spikes, and have ensured our rate limits are much higher than what is necessary for almost all applications. If your application requires a higher rate limit, we will evaluate your use case and may choose to increase your rate limit.
14+
When using a key to access Anteater API, you are bound by your own key-specific ratelimit instead of the global quota.
15+
Our goal with these rate limits is to support almost all applications while preventing abuse.
16+
We understand that student projects, especially those made for a hackathon, may experience sudden traffic spikes, and have ensured our rate limits are much higher than what is necessary for almost all applications.
17+
If your application requires a higher rate limit, we will evaluate your use case and may choose to increase your rate limit.
1218

1319
With that being said, we ask that all developers refrain from purposefully sending large amounts of requests in a short interval, or making malicious requests with the intent to exploit vulnerabilities in the API. We reserve the right to blacklist IP addresses making such requests.
1420

@@ -22,15 +28,17 @@ Publishable keys are intended to be used in client-side code and as such can be
2228

2329
Secret keys are intended to be used in server-side code, and should not be exposed since no additional verification is performed.
2430

25-
Regardless of the type of key, you'll have to send the key to the API in order to take advantage of its benefits. The following is a non-exhaustive list of code snippets for doing so using various HTTP libraries. If the library you're using isn't present below, please don't hesitate to open a pull request!
31+
Regardless of the type of key, you'll have to send the key to the API in order to take advantage of its benefits.
32+
You must provide your API key as a bearer token in your requests.
33+
If you don't know what that means, that's okay.
34+
The following is a non-exhaustive list of code snippets for doing so using common HTTP libraries.
35+
If the library you're using isn't present below, please don't hesitate to open a pull request!
2636

27-
<Tabs items={["Fetch API", "Axios", "Requests"]}>
37+
<Tabs items={["Fetch API", "Axios", "Requests (Python)"]}>
2838
<Tab value="Fetch API">
2939
```js
30-
import fetch from "cross-fetch"; // ESM import
31-
// const fetch = require("cross-fetch"); // CJS import
32-
3340
const res = await fetch(
41+
// or another endpoint
3442
"https://anteaterapi.com/v2/rest/websoc" +
3543
new URLSearchParams({
3644
year: "2023",
@@ -53,7 +61,7 @@ Regardless of the type of key, you'll have to send the key to the API in order t
5361
import axios from "axios"; // ESM import
5462
// const axios = require("axios"); // CJS import
5563

56-
const res = await axios.get("https://anteaterapi.com/v2/rest/websoc", {
64+
const res = await axios.get(/* or another endpoint */ "https://anteaterapi.com/v2/rest/websoc", {
5765
params: {
5866
year: "2023",
5967
quarter: "Spring",
@@ -68,11 +76,12 @@ Regardless of the type of key, you'll have to send the key to the API in order t
6876
```
6977

7078
</Tab>
71-
<Tab value="Requests">
79+
<Tab value="Requests (Python)">
7280
```py
7381
import requests
7482

7583
res = requests.get(
84+
# or another endpoint
7685
"https://anteaterapi.com/v2/rest/websoc",
7786
params={"year": "2023", "quarter": "Spring", "department": "COMPSCI"},
7887
headers={

โ€Žcontent/docs/developer/anteaterapi/meta.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"title": "Anteater API",
33
"icon": "Workflow",
44
"pages": [
5+
"getting-started",
56
"attribution-policy",
6-
"best-practices",
7+
"keys-limits",
78
"api-versioning",
89
"rest-api",
910
"graphql-api",

โ€Žcontent/docs/developer/anteaterapi/migrating.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ We believe that sunsetting PeterPortal API in favor of Anteater API will allow u
2525
Change the base URL used in your API calls to https://anteaterapi.com/v2/rest (for the REST API) or https://anteaterapi.com/v2/graphql (for the GraphQL API).
2626
</Step>
2727
<Step>
28-
Optional, but highly recommended: Request an API key at https://dashboard.anteaterapi.com, and use that API key in all of your API calls. More details can be found [here](/docs/developer/anteaterapi/best-practices#using-your-api-key).
28+
Optional, but highly recommended: Request an API key at https://dashboard.anteaterapi.com, and use that API key in all of your API calls. More details can be found [here](/docs/developer/anteaterapi/keys-limits#using-your-api-key).
2929
</Step>
3030
<Step>
3131
Read the section below that corresponds to your current usecase, and apply any modifications to your code.

0 commit comments

Comments
ย (0)