Getting started
Let's dive into that and create a new empty class. It depends where you would like to use this class so choose the respective module based on your case. I chose module 4_World
class ExampleApi
{
// Suggestion is to cache the api reference (do not create new instance for each call)
protected ref CRDTN_RestApiWrapper m_RestApi;
};As you can see, I just made an empty class with a cached reference to a RestApi wrapper class instance. Let's add the constructor to the class and setup the API upon the constructing our class ExampleApi
class ExampleApi
{
// Suggestion is to cache the api reference (do not create new instance for each call)
protected ref CRDTN_RestApiWrapper m_RestApi;
void ExampleApi()
{
// https://my-backend-server
string url = ""; // Use some endpoint you need to call request on
m_RestApi = new CRDTN_RestApiWrapper(url);
}
};Using GET method
Using POST method
Last updated