Skip to content

Commit 1c97aca

Browse files
authored
Merge pull request #68 from Foorack/gs-redirect
Gs redirect
2 parents 34972eb + 489ca1d commit 1c97aca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+321
-228
lines changed

Archive/ModerationAPI/Against.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://api.vrchat.cloud/api/1/auth/user/playermoderated
1212

1313

1414
## Requires Authentication
15-
Yes (See [here](/Authorization.md) for details)
15+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1616

1717
## Returns
1818

Authorization.md

-18
This file was deleted.

AvatarAPI/ChooseAvatar.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://api.vrchat.cloud/api/1/avatars/[ID]/select
1212
ID - the avatar id
1313

1414
## Requires Authentication
15-
Yes (See [here](/Authorization.md) for details)
15+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1616

1717
## Returns
1818

AvatarAPI/DeleteAvatar.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ https://api.vrchat.cloud/api/1/avatars/[ID]
1313
ID - the avatar id
1414

1515
## Requires Authentication
16-
Yes (See [here](/Authorization.md) for details)
16+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1717

1818
## Returns
1919

AvatarAPI/GetByID.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ https://api.vrchat.cloud/api/1/avatars/[ID]
1111
ID - the avatar id
1212

1313
## Requires Authentication
14-
Yes (See [here](/Authorization.md) for details)
14+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1515

1616
## Returns
1717

AvatarAPI/ListAvatars.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ GET
99
https://api.vrchat.cloud/api/1/avatars
1010

1111
## Requires Authentication
12-
Yes (See [here](/Authorization.md) for details)
12+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1313

1414
## Parameters
1515

AvatarAPI/SaveAvatar.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ID - the user id
2525
Any field in the [avatar](/AvatarAPI/GetByID.md) object
2626

2727
## Requires Authentication
28-
Yes (See [here](/Authorization.md) for details)
28+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
2929

3030
## Returns
3131

FavoritesAPI/AddFavorite.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ POST
1212
https://api.vrchat.cloud/api/1/favorites
1313

1414
## Requires Authentication
15-
Yes (See [here](/Authorization.md) for details)
15+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1616

1717
## Parameters
1818

FavoritesAPI/DeleteFavorite.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ https://api.vrchat.cloud/api/1/favorites/[ID]
1111
ID - The Favorite Id
1212

1313
## Requires Authentication
14-
Yes (See [here](/Authorization.md) for details)
14+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1515

1616
## Returns
1717

FavoritesAPI/GetFavorite.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ https://api.vrchat.cloud/api/1/favorites/[ID]
1111
ID - The Favorite Id
1212

1313
## Requires Authentication
14-
Yes (See [here](/Authorization.md) for details)
14+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1515

1616
## Returns
1717

FavoritesAPI/ListAllFavorites.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ GET
99
https://api.vrchat.cloud/api/1/favorites/
1010

1111
## Requires Authentication
12-
Yes (See [here](/Authorization.md) for details)
12+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1313

1414
## Parameters
1515

FeedbackAPI/GetWorldFeedback.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ WORLDID - The world id you want to fetch info about
1515
WORLDREVISION - The revision of the world you want to fetch info about.
1616

1717
## Requires Authentication
18-
Yes (See [here](/Authorization.md) for details)
18+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1919

2020
## Returns
2121

FileAPI/CreateFile.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ POST
1111
https://api.vrchat.cloud/api/1/file
1212

1313
## Requires Authentication
14-
Yes (See [here](/Authorization.md) for details)
14+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1515

1616
## Parameters
1717

FileAPI/CreateNewVersion.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fileMd5 | base64 string | file md5 checksum
4444
fileSizeInBytes | long | file size in bytes
4545

4646
## Requires Authentication
47-
Yes (See [here](/Authorization.md) for details)
47+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
4848

4949
## Returns
5050

FileAPI/DeleteFile.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ https://api.vrchat.cloud/api/1/file/[FILEID]
1313
FILEID - the file id
1414

1515
## Requires Authentication
16-
Yes (See [here](/Authorization.md) for details)
16+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1717

1818
## Returns
1919

FileAPI/FinishUpload.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ type - the file type
2121
- signature
2222

2323
## Requires Authentication
24-
Yes (See [here](/Authorization.md) for details)
24+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
2525

2626
## Returns

FileAPI/GetFile.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ https://api.vrchat.cloud/api/1/file/[FILEID]
1313
fileId - the file id
1414

1515
## Requires Authentication
16-
Yes (See [here](/Authorization.md) for details)
16+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1717

1818
## Returns
1919

FileAPI/StartUpload.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ partNumber - optional, for larger files it allows to do a multiplart upload
2525
- signature
2626

2727
## Requires Authentication
28-
Yes (See [here](/Authorization.md) for details)
28+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
2929

3030
## Returns

FileAPI/UploadStatus.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GET
1111
https://api.vrchat.cloud/api/1/file/[ID]/[VERSION]/[TYPE]/status
1212

1313
## Requires Authentication
14-
Yes (See [here](/Authorization.md) for details)
14+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1515

1616
## Returns
1717
unknown - currently it keep sending back server error

GettingStarted.md

-54
This file was deleted.

GettingStarted/Examples.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Examples
2+
3+
## Updating your bio with curl
4+
5+
For updating our own social status we will be using the [Update User Info](/UserAPI/UpdateInfo) endpoint, which is a "PUT request". HTTP has various method types to indicate the intent of the request. The ones used with VRChat are as following:
6+
7+
* **GET** - For fetching information
8+
* **POST** - For submitting **new** information
9+
* **PUT** - For updating existing information
10+
* **DELETE** - For deleting the targeted resource
11+
12+
GET requests does not have a message body, and can only carry arguments as parameters. This means arguments such as userId or search parameters are provided inside the URL.
13+
14+
```
15+
https://example.com/some/path/<userId>?searchName=<serach>&condensed=true
16+
```
17+
18+
POST and PUT requests carry a JSON-encoded message body, except for file-uploads which instead uses `multipart/form-data`.
19+
As we in this case will send a PUT request we have to encode it as a JSON payload.
20+
21+
In this case we will use curl to send a "PUT" request to *update* your bio. In the following command we begin with specifying `-b cookiejar.txt` to use the authentication cookies aquired previously [during Authentication](/GettingStarted/QuickStart?id=authorization), `-X PUT` to make it a PUT request, `-A "My User Agent` to ethically identify yourself (this is needed for the firewall, give your app a unique agent name), `-H "Content-Type: application/json'` to tell the API we are sending a JSON payload, `-d '{"bio":"Hello API!"}'` which is the JSON payload itself, and finally the target URL to `api.vrchat.cloud`.
22+
23+
```bash
24+
curl -b cookiejar.txt -X PUT -A "My User Agent" -H "Content-Type: application/json" -d '{"bio":"Hello API!"}' https://api.vrchat.cloud/api/1/users/<userId>
25+
```
26+
27+
After successful query you should get an entire [`Current User object`](/Objects/User.md#current-user-object) back. This is a large JSON object representing the state of your entire account. By looking through this data we can see - close to the top - your bio has changed to "Hello API".
28+
29+
## Updating your bio with Insomnia
30+
31+
This tutorial asumes you already have [Insomnia](https://insomnia.rest/download) downloaded and installed. We will begin with creating a new "Request Collection" and name it "VRChat".
32+
33+
![Create a Collection](../assets/examples_insomnia1.png)
34+
35+
We will now create our first Request in order to authenticate with the API. Click "New Request" (cyan rectangle) and name it "Authenticate". We will let it be of type GET and click Create.
36+
37+
![Create first Request](../assets/examples_insomnia2.png)
38+
39+
Select `Basic > "Basic Auth"` and enter your VRChat username and password. The target URL should be set to `https://api.vrchat.cloud/api/1/auth/user` and click Send.
40+
41+
![Set username/password](../assets/examples_insomnia3.png)
42+
43+
!> **Ethical practice!** Make sure to always set a custom `User-Agent` under Headers, to properly identify your requests. <!-- Intentional two spaces for newlines -->
44+
Good-practice is to set a short unique name for your application, as well as a contact method such as Discord. <!-- Intentional two spaces for newlines -->
45+
![Set a User-Agent header](../assets/examples_insomnia7.png)
46+
47+
If successful then we should have gotten 3 new cookies, as indicated by the cyan rectangle below. In the future you can click "Cookies" **top-left** (pink rectangle) to see your cookies. We can also see in the response body our **userId** (yellow rectangle), it is important to keep this as we will need it for the next request.
48+
49+
![Successful authentication](../assets/examples_insomnia4.png)
50+
51+
Next we will create our second Request to update our Biography, click "New Request" indicated by the purple rectangle. We will name this one "Update Bio", we will set it to method type **PUT** and of body type **JSON**:
52+
53+
![Create second Request](../assets/examples_insomnia5.png)
54+
55+
Set the `User-Agent` again, although this time it is **important NOT to** set Auth again. Entering your username/password again will make you constantly request new session tokens, depleting your pool of available sessions and getting you rate-limited until the previous ones expire. Instead we will automatically authenticate with the cookies aquired in the previous Authentication request.
56+
57+
To finally update the Bio we set the URL to `https://api.vrchat.cloud/api/1/users/<userId>` where `<userId>` is **your** userId found in the previous request, and the message body set to the following:
58+
59+
```json
60+
{
61+
"bio": "Hello API!"
62+
}
63+
```
64+
65+
Click "Send" and we can see in the bottom right the Bio has now been updated to the new text:
66+
67+
![Update the Bio](../assets/examples_insomnia6.png)
68+
69+
?> **Congratulations!** You have now ready to explore the API. Please keep in mind the strict rate-limit, and that any abuse can lead to permanent account termination.
70+
71+
See [`Current User object`](/Objects/User.md#current-user-object) for a full list of values possible to set. Note some values such as `date_joined`, `last_login` and `friends` are either system-generated and not possible to change, or values which you change through other endpoints (such as adding friends through the Friends API).

GettingStarted/QuickStart.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Quick Start
2+
3+
!> **Super Important!** Usege of the API is **NOT** allowed for malicious purposes. Abuse of the API may result in account termination! Please read the [Disclaimer](/README?id=disclaimer) before getting started!
4+
5+
The VRChat API (application programming interface) can be used to programatically retrive or update information regarding your profile, friends, avatars and worlds. The API consists of two parts, "Photon" which is only used in-game, and the "Web API" which is used by both the game and the website, and which is the focus of this documentation.
6+
7+
The Web API operates over the HTTP protocol and transmits data in JSON format. It is what is called [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete), meaning it is stateless, requiring no information of the current state or the request sent previously, and the type of operation is determined by the HTTP method. Almost all API calls also require you to be be authenticated and to abide by the rate-limit.
8+
9+
## Documentation notes
10+
11+
?> These docs are for Unity SDK version `2018.4.20f1` and build tag `master-build-2021-03-26`.
12+
13+
Sections of the documentation labeled **Outdated** means the article or endpoint is no longer supported or that the documentation is out-of-date. Sections labeled **Soon** are work in progress articles, while sections labeled **Beta** are endpoints found in the beta client, and are not yet released into production.
14+
15+
## API Libraries
16+
17+
There are various pre-written libraries which can be used to interact with the API. Depending on the programming languages these libraries are mantained to varying degree, and while most have basic functionality they can lack more unusual endpoitns or not be updated in terms of recent changes to the API.
18+
19+
1. VRCpy (Python) https://github.com/VRChatAPI/VRChatPython
20+
21+
2. ~~VRChat.Net (C#) https://github.com/VRChatAPI/VRChat.Net~~ (outdated)
22+
23+
3. ~~VRChatJava (Java) https://github.com/VRChatAPI/VRChatJava~~ (outdated)
24+
25+
Out of these the Python library is the one most updated, and therefore the most recommended. For other languages it is possible to use a generic HTTP client, such as [Axios](https://github.com/axios/axios) for NodeJS or the new [HttpClient](https://dzone.com/articles/java-11-standardized-http-client-api) in Java 11. There are also graphical API clients such as [Postman](https://www.postman.com/downloads/) and [Insomnia](https://insomnia.rest/download).
26+
27+
This documentation will show examples using curl, a command-line client allowing you to test various endpoints directly without writing a program. Curl can be [downloadable for Windows](https://curl.se/windows/) and installed with `sudo apt-get install curl` on Linux or `brew install curl` on MacOS.
28+
29+
```bash
30+
$ curl https://api.vrchat.cloud/api/1/health
31+
{
32+
"ok": true,
33+
"serverName": "prod-api-blue-power-0by",
34+
"buildVersionTag": "master-build-2021-04-22-ben-bearcrayon"
35+
}
36+
```
37+
38+
## Client API Key
39+
40+
Every API requires you to give a special API key. To get it simply call the [Remote Config](/SystemAPI/Config.md) endpoint. The API key can be passed in either a query parameter named `apiKey` or by setting a cookie with the name.
41+
42+
?> The last known key is `JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26`
43+
44+
```bash
45+
$ curl https://vrchat.com/api/1/users
46+
{"error":{"message":"\"No API Key provided!\"","status_code":401}}
47+
# FAIL: Missing apiKey, as this is a GET request we will provide it as a URL parameter.
48+
49+
$ curl https://vrchat.com/api/1/users?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26
50+
{"error":{"message":"\"Missing Credentials\"","status_code":401}}
51+
# SUCCESS: We will now proced to authenticating.
52+
```
53+
54+
## Authorization
55+
56+
!> **Session Limit**: Each authentication with login credentials counts as a separate session, out of which you have a limited amount. Make sure to save and reuse the authcookie whenever you can, and avoid sending the Authorization header unless strictly neccesary.
57+
58+
Most of the APIs require you to be authenticated, and VRChat does authorization using the [`Authorization header`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization). The username and password are encoded using base64, and then sent to the API endpoint `/api/1/auth/user`.
59+
60+
After authenticating against the API it is **critical** to save and reuse the returned `auth` cookie. Each authentication with login credentials counts as a separate "session", out of which you have a limited amount. Authorization tokens expire either by not using them for a certain period of time, or by using the [`Logout endpoint`](/UserAPI/Logout.md).
61+
62+
```bash
63+
# Windows (using Powershell)
64+
$ [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('username:password'))
65+
dXNlcm5hbWU6cGFzc3dvcmQ=
66+
67+
# Linux / MacOS
68+
$ echo -n "username:password" | base64
69+
dXNlcm5hbWU6cGFzc3dvcmQ=
70+
71+
# Request an authcookie
72+
# The 'auth' cookie is saved to "cookiejar.txt", this makes it easier to re-use in future commands.
73+
# Replace the base64-encoded string "Rm9vcmFjazptYXhmYXgyNTI1ISE" with the one generated in one of the previous commands.
74+
# Also replace "My User Agent" with a custom and unique agent name to identify yourself!
75+
$ curl -c cookiejar.txt -A "My User Agent" -H "Authorization: Basic Rm9vcmFjazptYXhmYXgyNTI1ISE=" https://api.vrchat.cloud/api/1/auth/user
76+
```
77+
78+
For this we will first encode the username and password as base64. We will then authenticate against the API and save the resulting `apiKey` and `auth` cookies to `cookiejar.txt`. We will be using this file in future commands when interacting with the API. In case the auth token expires, simply delete the file and run the command again.

ModerationAPI/Against.md

-4
This file was deleted.

ModerationAPI/ClearModerations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ https://api.vrchat.cloud/api/1/user/[ID]/moderations
1111
ID - the id of the user
1212

1313
## Requires Authentication
14-
Yes (See [here](/Authorization.md) for details)
14+
Yes (See [here](/GettingStarted/QuickStart?id=authorization) for details)
1515

1616
## Returns
1717

0 commit comments

Comments
 (0)