Skip to content

Latest commit

 

History

History
439 lines (345 loc) · 18.1 KB

RedirectsApi.md

File metadata and controls

439 lines (345 loc) · 18.1 KB

Com.Sajari.Sdk.Api.RedirectsApi

All URIs are relative to https://api.search.io

Method HTTP request Description
CreateRedirect POST /v4/collections/{collection_id}/redirects Create redirect
DeleteRedirect DELETE /v4/collections/{collection_id}/redirects/{redirect_id} Delete redirect
GetRedirect GET /v4/collections/{collection_id}/redirects/{redirect_id} Get redirect
ListRedirects GET /v4/collections/{collection_id}/redirects List redirects
UpdateRedirect PATCH /v4/collections/{collection_id}/redirects/{redirect_id} Update redirect

CreateRedirect

Redirect CreateRedirect (string collectionId, Redirect redirect, string accountId = null)

Create redirect

Create a new redirect in a collection.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class CreateRedirectExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new RedirectsApi(config);
            var collectionId = "collectionId_example";  // string | The collection to create a redirect in, e.g. `my-collection`.
            var redirect = new Redirect(); // Redirect | The redirect to create.
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`. (optional) 

            try
            {
                // Create redirect
                Redirect result = apiInstance.CreateRedirect(collectionId, redirect, accountId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling RedirectsApi.CreateRedirect: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
collectionId string The collection to create a redirect in, e.g. `my-collection`.
redirect Redirect The redirect to create.
accountId string The account that owns the collection, e.g. `1618535966441231024`. [optional]

Return type

Redirect

Authorization

BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 A successful response. -
401 Returned when the request does not have valid authentication credentials. -
403 Returned when the user does not have permission to access the resource. -
404 Returned when the resource does not exist. -
500 Returned when the API encounters an internal error. -
0 An unexpected error response. -

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

DeleteRedirect

Object DeleteRedirect (string collectionId, string redirectId, string accountId = null)

Delete redirect

Delete a redirect and all of its associated data. > Note: This operation cannot be reversed.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class DeleteRedirectExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new RedirectsApi(config);
            var collectionId = "collectionId_example";  // string | The collection the redirect belongs to, e.g. `my-collection`.
            var redirectId = "redirectId_example";  // string | The redirect to delete, e.g. `1234`.
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`. (optional) 

            try
            {
                // Delete redirect
                Object result = apiInstance.DeleteRedirect(collectionId, redirectId, accountId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling RedirectsApi.DeleteRedirect: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
collectionId string The collection the redirect belongs to, e.g. `my-collection`.
redirectId string The redirect to delete, e.g. `1234`.
accountId string The account that owns the collection, e.g. `1618535966441231024`. [optional]

Return type

Object

Authorization

BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 A successful response. -
401 Returned when the request does not have valid authentication credentials. -
403 Returned when the user does not have permission to access the resource. -
404 Returned when the redirect was not found. -
500 Returned when the API encounters an internal error. -
0 An unexpected error response. -

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

GetRedirect

Redirect GetRedirect (string collectionId, string redirectId, string accountId = null)

Get redirect

Retrieve the details of a redirect.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class GetRedirectExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new RedirectsApi(config);
            var collectionId = "collectionId_example";  // string | The collection that owns the redirect, e.g. `my-collection`.
            var redirectId = "redirectId_example";  // string | The redirect to retrieve, e.g. `1234`.
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`. (optional) 

            try
            {
                // Get redirect
                Redirect result = apiInstance.GetRedirect(collectionId, redirectId, accountId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling RedirectsApi.GetRedirect: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
collectionId string The collection that owns the redirect, e.g. `my-collection`.
redirectId string The redirect to retrieve, e.g. `1234`.
accountId string The account that owns the collection, e.g. `1618535966441231024`. [optional]

Return type

Redirect

Authorization

BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 A successful response. -
401 Returned when the request does not have valid authentication credentials. -
403 Returned when the user does not have permission to access the resource. -
404 Returned when the resource does not exist. -
500 Returned when the API encounters an internal error. -
0 An unexpected error response. -

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

ListRedirects

ListRedirectsResponse ListRedirects (string collectionId, string accountId = null, int? pageSize = null, string pageToken = null)

List redirects

Retrieve a list of redirects in a collection.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class ListRedirectsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new RedirectsApi(config);
            var collectionId = "collectionId_example";  // string | The collection that owns this set of redirects, e.g. `my-collection`.
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`. (optional) 
            var pageSize = 56;  // int? | The maximum number of redirects to return. The service may return fewer than this value.  If unspecified, at most 50 redirects are returned.  The maximum value is 1000; values above 1000 are coerced to 1000. (optional) 
            var pageToken = "pageToken_example";  // string | A page token, received from a previous [ListRedirects](/docs/api#operation/ListRedirects) call.  Provide this to retrieve the subsequent page.  When paginating, all other parameters provided to [ListRedirects](/docs/api#operation/ListRedirects) must match the call that provided the page token. (optional) 

            try
            {
                // List redirects
                ListRedirectsResponse result = apiInstance.ListRedirects(collectionId, accountId, pageSize, pageToken);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling RedirectsApi.ListRedirects: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
collectionId string The collection that owns this set of redirects, e.g. `my-collection`.
accountId string The account that owns the collection, e.g. `1618535966441231024`. [optional]
pageSize int? The maximum number of redirects to return. The service may return fewer than this value. If unspecified, at most 50 redirects are returned. The maximum value is 1000; values above 1000 are coerced to 1000. [optional]
pageToken string A page token, received from a previous ListRedirects call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListRedirects must match the call that provided the page token. [optional]

Return type

ListRedirectsResponse

Authorization

BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 A successful response. -
401 Returned when the request does not have valid authentication credentials. -
403 Returned when the user does not have permission to access the resource. -
404 Returned when the resource does not exist. -
500 Returned when the API encounters an internal error. -
0 An unexpected error response. -

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

UpdateRedirect

Redirect UpdateRedirect (string collectionId, string redirectId, string updateMask, Redirect redirect, string accountId = null)

Update redirect

Update the details of a redirect. Pass each field that you want to update in the request body. Also specify the name of each field that you want to update in the update_mask in the request URL query string. Separate multiple fields with a comma. Fields included in the request body, but not included in the field mask are not updated. For example, to update the condition field, make a PATCH request to the URL: /v4/collections/{collection_id}/redirects/{redirect_id}?update_mask=condition With the JSON body: { \"condition\": \"new value\", \"target\": \"...\" } > Note: In this example target is not updated because it is not specified in the update_mask.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class UpdateRedirectExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new RedirectsApi(config);
            var collectionId = "collectionId_example";  // string | The collection the redirect belongs to, e.g. `my-collection`.
            var redirectId = "redirectId_example";  // string | The redirect to update, e.g. `1234`.
            var updateMask = "updateMask_example";  // string | The list of fields to be updated, separated by a comma, e.g. `field1,field2`.  Each field should be in snake case, e.g. `condition`, `target`.  For each field that you want to update, provide a corresponding value in the redirect object containing the new value.
            var redirect = new Redirect(); // Redirect | Details of the redirect to update.
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`. (optional) 

            try
            {
                // Update redirect
                Redirect result = apiInstance.UpdateRedirect(collectionId, redirectId, updateMask, redirect, accountId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling RedirectsApi.UpdateRedirect: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
collectionId string The collection the redirect belongs to, e.g. `my-collection`.
redirectId string The redirect to update, e.g. `1234`.
updateMask string The list of fields to be updated, separated by a comma, e.g. `field1,field2`. Each field should be in snake case, e.g. `condition`, `target`. For each field that you want to update, provide a corresponding value in the redirect object containing the new value.
redirect Redirect Details of the redirect to update.
accountId string The account that owns the collection, e.g. `1618535966441231024`. [optional]

Return type

Redirect

Authorization

BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 A successful response. -
401 Returned when the request does not have valid authentication credentials. -
403 Returned when the user does not have permission to access the resource. -
404 Returned when the redirect was not found. -
500 Returned when the API encounters an internal error. -
0 An unexpected error response. -

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