Class RestAPI
Represents the RestAPI class that provides functionality to interact with MindsDB API endpoints.
public class RestAPI
- Inheritance
-
RestAPI
- Inherited Members
Constructors
RestAPI(string, string)
Initializes a new instance of the RestAPI class. Sets up the API base URL and initializes the HttpClient with the provided API key for authorization.
public RestAPI(string apiKey, string baseUrl = null)
Parameters
apiKey
stringThe API key used for authenticating requests.
baseUrl
stringThe base URL of the API (optional). If not provided, defaults to https://mdb.ai.
Methods
Delete(string)
Sends an asynchronous DELETE request to the specified URL.
public Task<HttpResponseMessage> Delete(string url)
Parameters
url
stringThe URL relative to the API base path.
Returns
- Task<HttpResponseMessage>
A task that represents the asynchronous operation, with the HTTP response as the result.
Get<T>(string)
Sends an asynchronous GET request to the specified URL and returns the deserialized response.
public Task<T> Get<T>(string url)
Parameters
url
stringThe URL relative to the API base path.
Returns
- Task<T>
A task that represents the asynchronous operation, with the deserialized response as the result.
Type Parameters
T
The type of the response object.
Patch(string, object)
Sends an asynchronous PATCH request with the specified data serialized as JSON.
public Task<HttpResponseMessage> Patch(string url, object data)
Parameters
url
stringThe URL relative to the API base path.
data
objectThe object to be serialized and sent in the request body.
Returns
- Task<HttpResponseMessage>
A task that represents the asynchronous operation, with the HTTP response as the result.
Post(string, object)
Sends an asynchronous POST request with the specified data serialized as JSON.
public Task<HttpResponseMessage> Post(string url, object data)
Parameters
url
stringThe URL relative to the API base path.
data
objectThe object to be serialized and sent in the request body.
Returns
- Task<HttpResponseMessage>
A task that represents the asynchronous operation, with the HTTP response as the result.