Skip to content

Latest commit

 

History

History
398 lines (290 loc) · 14 KB

RedirectsApi.md

File metadata and controls

398 lines (290 loc) · 14 KB

SajariAPIClient::RedirectsApi

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

Method HTTP request Description
create_redirect POST /v4/collections/{collection_id}/redirects Create redirect
delete_redirect DELETE /v4/collections/{collection_id}/redirects/{redirect_id} Delete redirect
get_redirect GET /v4/collections/{collection_id}/redirects/{redirect_id} Get redirect
list_redirects GET /v4/collections/{collection_id}/redirects List redirects
update_redirect PATCH /v4/collections/{collection_id}/redirects/{redirect_id} Update redirect

create_redirect

create_redirect(collection_id, redirect, opts)

Create redirect

Create a new redirect in a collection.

Examples

require 'time'
require 'sdk_ruby'
# setup authorization
SajariAPIClient.configure do |config|
  # Configure HTTP basic authorization: BasicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'
end

api_instance = SajariAPIClient::RedirectsApi.new
collection_id = 'collection_id_example' # String | The collection to create a redirect in, e.g. `my-collection`.
redirect = SajariAPIClient::Redirect.new({condition: 'condition_example', target: 'target_example'}) # Redirect | The redirect to create.
opts = {
  account_id: 'account_id_example' # String | The account that owns the collection, e.g. `1618535966441231024`.
}

begin
  # Create redirect
  result = api_instance.create_redirect(collection_id, redirect, opts)
  p result
rescue SajariAPIClient::ApiError => e
  puts "Error when calling RedirectsApi->create_redirect: #{e}"
end

Using the create_redirect_with_http_info variant

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

<Array(, Integer, Hash)> create_redirect_with_http_info(collection_id, redirect, opts)

begin
  # Create redirect
  data, status_code, headers = api_instance.create_redirect_with_http_info(collection_id, redirect, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Redirect>
rescue SajariAPIClient::ApiError => e
  puts "Error when calling RedirectsApi->create_redirect_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
collection_id String The collection to create a redirect in, e.g. `my-collection`.
redirect Redirect The redirect to create.
account_id 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

delete_redirect

Object delete_redirect(collection_id, redirect_id, opts)

Delete redirect

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

Examples

require 'time'
require 'sdk_ruby'
# setup authorization
SajariAPIClient.configure do |config|
  # Configure HTTP basic authorization: BasicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'
end

api_instance = SajariAPIClient::RedirectsApi.new
collection_id = 'collection_id_example' # String | The collection the redirect belongs to, e.g. `my-collection`.
redirect_id = 'redirect_id_example' # String | The redirect to delete, e.g. `1234`.
opts = {
  account_id: 'account_id_example' # String | The account that owns the collection, e.g. `1618535966441231024`.
}

begin
  # Delete redirect
  result = api_instance.delete_redirect(collection_id, redirect_id, opts)
  p result
rescue SajariAPIClient::ApiError => e
  puts "Error when calling RedirectsApi->delete_redirect: #{e}"
end

Using the delete_redirect_with_http_info variant

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

<Array(Object, Integer, Hash)> delete_redirect_with_http_info(collection_id, redirect_id, opts)

begin
  # Delete redirect
  data, status_code, headers = api_instance.delete_redirect_with_http_info(collection_id, redirect_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => Object
rescue SajariAPIClient::ApiError => e
  puts "Error when calling RedirectsApi->delete_redirect_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
collection_id String The collection the redirect belongs to, e.g. `my-collection`.
redirect_id String The redirect to delete, e.g. `1234`.
account_id 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

get_redirect

get_redirect(collection_id, redirect_id, opts)

Get redirect

Retrieve the details of a redirect.

Examples

require 'time'
require 'sdk_ruby'
# setup authorization
SajariAPIClient.configure do |config|
  # Configure HTTP basic authorization: BasicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'
end

api_instance = SajariAPIClient::RedirectsApi.new
collection_id = 'collection_id_example' # String | The collection that owns the redirect, e.g. `my-collection`.
redirect_id = 'redirect_id_example' # String | The redirect to retrieve, e.g. `1234`.
opts = {
  account_id: 'account_id_example' # String | The account that owns the collection, e.g. `1618535966441231024`.
}

begin
  # Get redirect
  result = api_instance.get_redirect(collection_id, redirect_id, opts)
  p result
rescue SajariAPIClient::ApiError => e
  puts "Error when calling RedirectsApi->get_redirect: #{e}"
end

Using the get_redirect_with_http_info variant

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

<Array(, Integer, Hash)> get_redirect_with_http_info(collection_id, redirect_id, opts)

begin
  # Get redirect
  data, status_code, headers = api_instance.get_redirect_with_http_info(collection_id, redirect_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Redirect>
rescue SajariAPIClient::ApiError => e
  puts "Error when calling RedirectsApi->get_redirect_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
collection_id String The collection that owns the redirect, e.g. `my-collection`.
redirect_id String The redirect to retrieve, e.g. `1234`.
account_id 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

list_redirects

list_redirects(collection_id, opts)

List redirects

Retrieve a list of redirects in a collection.

Examples

require 'time'
require 'sdk_ruby'
# setup authorization
SajariAPIClient.configure do |config|
  # Configure HTTP basic authorization: BasicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'
end

api_instance = SajariAPIClient::RedirectsApi.new
collection_id = 'collection_id_example' # String | The collection that owns this set of redirects, e.g. `my-collection`.
opts = {
  account_id: 'account_id_example', # String | The account that owns the collection, e.g. `1618535966441231024`.
  page_size: 56, # Integer | 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.
  page_token: 'page_token_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.
}

begin
  # List redirects
  result = api_instance.list_redirects(collection_id, opts)
  p result
rescue SajariAPIClient::ApiError => e
  puts "Error when calling RedirectsApi->list_redirects: #{e}"
end

Using the list_redirects_with_http_info variant

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

<Array(, Integer, Hash)> list_redirects_with_http_info(collection_id, opts)

begin
  # List redirects
  data, status_code, headers = api_instance.list_redirects_with_http_info(collection_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <ListRedirectsResponse>
rescue SajariAPIClient::ApiError => e
  puts "Error when calling RedirectsApi->list_redirects_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
collection_id String The collection that owns this set of redirects, e.g. `my-collection`.
account_id String The account that owns the collection, e.g. `1618535966441231024`. [optional]
page_size Integer 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]
page_token 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

update_redirect

update_redirect(collection_id, redirect_id, update_mask, redirect, opts)

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.

Examples

require 'time'
require 'sdk_ruby'
# setup authorization
SajariAPIClient.configure do |config|
  # Configure HTTP basic authorization: BasicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'
end

api_instance = SajariAPIClient::RedirectsApi.new
collection_id = 'collection_id_example' # String | The collection the redirect belongs to, e.g. `my-collection`.
redirect_id = 'redirect_id_example' # String | The redirect to update, e.g. `1234`.
update_mask = 'update_mask_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.
redirect = SajariAPIClient::Redirect.new({condition: 'condition_example', target: 'target_example'}) # Redirect | Details of the redirect to update.
opts = {
  account_id: 'account_id_example' # String | The account that owns the collection, e.g. `1618535966441231024`.
}

begin
  # Update redirect
  result = api_instance.update_redirect(collection_id, redirect_id, update_mask, redirect, opts)
  p result
rescue SajariAPIClient::ApiError => e
  puts "Error when calling RedirectsApi->update_redirect: #{e}"
end

Using the update_redirect_with_http_info variant

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

<Array(, Integer, Hash)> update_redirect_with_http_info(collection_id, redirect_id, update_mask, redirect, opts)

begin
  # Update redirect
  data, status_code, headers = api_instance.update_redirect_with_http_info(collection_id, redirect_id, update_mask, redirect, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Redirect>
rescue SajariAPIClient::ApiError => e
  puts "Error when calling RedirectsApi->update_redirect_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
collection_id String The collection the redirect belongs to, e.g. `my-collection`.
redirect_id String The redirect to update, e.g. `1234`.
update_mask 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.
account_id 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