Skip to content

Latest commit

 

History

History
510 lines (407 loc) · 16.8 KB

InstancesApi.md

File metadata and controls

510 lines (407 loc) · 16.8 KB

VRChat.API.Api.InstancesApi

All URIs are relative to https://api.vrchat.cloud/api/1

Method HTTP request Description
CloseInstance DELETE /instances/{worldId}:{instanceId} Close Instance
CreateInstance POST /instances Create Instance
GetInstance GET /instances/{worldId}:{instanceId} Get Instance
GetInstanceByShortName GET /instances/s/{shortName} Get Instance By Short Name
GetShortName GET /instances/{worldId}:{instanceId}/shortName Get Instance Short Name

CloseInstance

Instance CloseInstance (string worldId, string instanceId, bool? hardClose = null, DateTime? closedAt = null)

Close Instance

Close an instance or update the closedAt time when it will be closed. You can only close an instance if the ownerId is yourself or if the instance owner is a group and you have the group-instance-moderate permission.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class CloseInstanceExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new InstancesApi(config);
            var worldId = "worldId_example";  // string | Must be a valid world ID.
            var instanceId = "instanceId_example";  // string | Must be a valid instance ID.
            var hardClose = true;  // bool? | Whether to hard close the instance. Defaults to false. (optional) 
            var closedAt = DateTime.Parse("2013-10-20T19:20:30+01:00");  // DateTime? | The time after which users won't be allowed to join the instances. If omitted, the instance will be closed immediately. (optional) 

            try
            {
                // Close Instance
                Instance result = apiInstance.CloseInstance(worldId, instanceId, hardClose, closedAt);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling InstancesApi.CloseInstance: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CloseInstanceWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Close Instance
    ApiResponse<Instance> response = apiInstance.CloseInstanceWithHttpInfo(worldId, instanceId, hardClose, closedAt);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling InstancesApi.CloseInstanceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
worldId string Must be a valid world ID.
instanceId string Must be a valid instance ID.
hardClose bool? Whether to hard close the instance. Defaults to false. [optional]
closedAt DateTime? The time after which users won't be allowed to join the instances. If omitted, the instance will be closed immediately. [optional]

Return type

Instance

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Returns a single Instance object. -
401 Error response due to missing auth cookie. -
403 Error response due to not being allowed to close an instance -
404 Error response due to non existant instance -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateInstance

Instance CreateInstance (CreateInstanceRequest createInstanceRequest)

Create Instance

Create an instance

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class CreateInstanceExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new InstancesApi(config);
            var createInstanceRequest = new CreateInstanceRequest(); // CreateInstanceRequest | 

            try
            {
                // Create Instance
                Instance result = apiInstance.CreateInstance(createInstanceRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling InstancesApi.CreateInstance: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateInstanceWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Instance
    ApiResponse<Instance> response = apiInstance.CreateInstanceWithHttpInfo(createInstanceRequest);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling InstancesApi.CreateInstanceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
createInstanceRequest CreateInstanceRequest

Return type

Instance

Authorization

authCookie

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Returns a single Instance object. -
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetInstance

Instance GetInstance (string worldId, string instanceId)

Get Instance

Returns an instance. Please read Instances Tutorial for more information on Instances. If an invalid instanceId is provided, this endpoint will simply return "null"!

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class GetInstanceExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new InstancesApi(config);
            var worldId = "worldId_example";  // string | Must be a valid world ID.
            var instanceId = "instanceId_example";  // string | Must be a valid instance ID.

            try
            {
                // Get Instance
                Instance result = apiInstance.GetInstance(worldId, instanceId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling InstancesApi.GetInstance: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetInstanceWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get Instance
    ApiResponse<Instance> response = apiInstance.GetInstanceWithHttpInfo(worldId, instanceId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling InstancesApi.GetInstanceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
worldId string Must be a valid world ID.
instanceId string Must be a valid instance ID.

Return type

Instance

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Returns a single Instance object. -
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetInstanceByShortName

Instance GetInstanceByShortName (string shortName)

Get Instance By Short Name

Returns an instance. Please read Instances Tutorial for more information on Instances.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class GetInstanceByShortNameExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new InstancesApi(config);
            var shortName = "shortName_example";  // string | Must be a valid instance short name.

            try
            {
                // Get Instance By Short Name
                Instance result = apiInstance.GetInstanceByShortName(shortName);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling InstancesApi.GetInstanceByShortName: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetInstanceByShortNameWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get Instance By Short Name
    ApiResponse<Instance> response = apiInstance.GetInstanceByShortNameWithHttpInfo(shortName);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling InstancesApi.GetInstanceByShortNameWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
shortName string Must be a valid instance short name.

Return type

Instance

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Returns a single Instance object. -
401 Error response due to missing auth cookie. -
404 Error response due to non existant instance -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetShortName

InstanceShortNameResponse GetShortName (string worldId, string instanceId)

Get Instance Short Name

Returns an instance short name.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class GetShortNameExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new InstancesApi(config);
            var worldId = "worldId_example";  // string | Must be a valid world ID.
            var instanceId = "instanceId_example";  // string | Must be a valid instance ID.

            try
            {
                // Get Instance Short Name
                InstanceShortNameResponse result = apiInstance.GetShortName(worldId, instanceId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling InstancesApi.GetShortName: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetShortNameWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get Instance Short Name
    ApiResponse<InstanceShortNameResponse> response = apiInstance.GetShortNameWithHttpInfo(worldId, instanceId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling InstancesApi.GetShortNameWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
worldId string Must be a valid world ID.
instanceId string Must be a valid instance ID.

Return type

InstanceShortNameResponse

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Returns an instance secureName and/or shortName. -
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]