- Coscine.ApiClient.Core.Api.SearchApi
- ApiV2SearchOptions
- Example
- Using the ApiV2SearchOptionsWithHttpInfo variant
- Parameters
- Return type
- Authorization
- HTTP request headers
- HTTP response details
- GetSearchResults
- Example
- Using the GetSearchResultsWithHttpInfo variant
- Parameters
- Return type
- Authorization
- HTTP request headers
- HTTP response details
Coscine.ApiClient.Core.Api.SearchApi
All URIs are relative to https://coscine-api-hristov.web.vulcanus.otc.coscine.dev/coscine
Method | HTTP request | Description |
---|---|---|
ApiV2SearchOptions | OPTIONS /api/v2/search | Responds with the HTTP methods allowed for the endpoint. |
GetSearchResults | GET /api/v2/search | Retrieves a search result by given search parameters. |
ApiV2SearchOptions
void ApiV2SearchOptions ()
Responds with the HTTP methods allowed for the endpoint.
Example
using System.Collections.Generic;
using System.Diagnostics;
using Coscine.ApiClient.Core.Api;
using Coscine.ApiClient.Core.Client;
using Coscine.ApiClient.Core.Model;
namespace Example
{
public class ApiV2SearchOptionsExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://coscine-api-hristov.web.vulcanus.otc.coscine.dev/coscine";
// Configure API key authorization: Bearer
config.AddApiKey("Authorization", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("Authorization", "Bearer");
var apiInstance = new SearchApi(config);
try
{
// Responds with the HTTP methods allowed for the endpoint.
apiInstance.ApiV2SearchOptions();
}
catch (ApiException e)
{
Debug.Print("Exception when calling SearchApi.ApiV2SearchOptions: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the ApiV2SearchOptionsWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Responds with the HTTP methods allowed for the endpoint.
apiInstance.ApiV2SearchOptionsWithHttpInfo();
}
catch (ApiException e)
{
Debug.Print("Exception when calling SearchApi.ApiV2SearchOptionsWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
HTTP response details
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
Back to top(#) Back to API list(../README.md#documentation-for-api-endpoints) Back to Model list(../README.md#documentation-for-models) Back to README(../README.md)
GetSearchResults
SearchResultDtoPagedSearchResponse GetSearchResults (string? query = null, bool? useAdvancedSyntax = null, List? languages = null, SearchCategoryType? category = null, int? pageNumber = null, int? pageSize = null, string? orderBy = null)
Retrieves a search result by given search parameters.
Example
using System.Collections.Generic;
using System.Diagnostics;
using Coscine.ApiClient.Core.Api;
using Coscine.ApiClient.Core.Client;
using Coscine.ApiClient.Core.Model;
namespace Example
{
public class GetSearchResultsExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://coscine-api-hristov.web.vulcanus.otc.coscine.dev/coscine";
// Configure API key authorization: Bearer
config.AddApiKey("Authorization", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("Authorization", "Bearer");
var apiInstance = new SearchApi(config);
var query = "query_example"; // string? | The search query (optional)
var useAdvancedSyntax = true; // bool? | Set true for advanced Elasticsearch search syntax (optional)
var languages = new List<string>?(); // List<string>? | Set the used languages (optional)
var category = new SearchCategoryType?(); // SearchCategoryType? | Set the category filter (optional)
var pageNumber = 56; // int? | The desired page number. Should be greater than or equal to 1. Default is 1. (optional)
var pageSize = 56; // int? | The desired page size. Should be between 1 and the maximum allowed page size (50). Default is 10. (optional)
var orderBy = "orderBy_example"; // string? | Gets or sets the field name used for ordering the results. The order is constructed by a order string. Use the property followed by \"asc\" or \"desc\" and separate properties by commas. Default is asc. (optional)
try
{
// Retrieves a search result by given search parameters.
SearchResultDtoPagedSearchResponse result = apiInstance.GetSearchResults(query, useAdvancedSyntax, languages, category, pageNumber, pageSize, orderBy);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling SearchApi.GetSearchResults: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the GetSearchResultsWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Retrieves a search result by given search parameters.
ApiResponse<SearchResultDtoPagedSearchResponse> response = apiInstance.GetSearchResultsWithHttpInfo(query, useAdvancedSyntax, languages, category, pageNumber, pageSize, orderBy);
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 SearchApi.GetSearchResultsWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
query | string? | The search query | [optional] |
useAdvancedSyntax | bool? | Set true for advanced Elasticsearch search syntax | [optional] |
languages | List<string>? | Set the used languages | [optional] |
category | SearchCategoryType? | Set the category filter | [optional] |
pageNumber | int? | The desired page number. Should be greater than or equal to 1. Default is 1. | [optional] |
pageSize | int? | The desired page size. Should be between 1 and the maximum allowed page size (50). Default is 10. | [optional] |
orderBy | string? | Gets or sets the field name used for ordering the results. The order is constructed by a order string. Use the property followed by "asc" or "desc" and separate properties by commas. Default is asc. | [optional] |
Return type
SearchResultDtoPagedSearchResponse
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, text/json
HTTP response details
Status code | Description | Response headers |
---|---|---|
200 | Returns the search result. | - |
403 | User is missing authorization requirements. | - |
400 | Provided input has a bad format. | - |
404 | Provided input refers to entries that do not exist or have been deleted. | - |
Back to top(#) Back to API list(../README.md#documentation-for-api-endpoints) Back to Model list(../README.md#documentation-for-models) Back to README(../README.md)