Skip to content

Latest commit

 

History

History
266 lines (179 loc) · 8.34 KB

File metadata and controls

266 lines (179 loc) · 8.34 KB

clientapi_cpanel.MimeTypeManagementApi

All URIs are relative to https://cpanel-server.tld:2083/execute

Method HTTP request Description
add_mime GET /Mime/add_mime Add MIME type to web server
delete_mime GET /Mime/delete_mime Remove MIME type from web server
list_mime GET /Mime/list_mime Return web server's MIME types

add_mime

InlineResponse200318 add_mime(extension, type)

Add MIME type to web server

This function adds a MIME type to Apache.

Important:

When you disable the Web Server role, the system disables this function.

Example

  • Basic Authentication (BasicAuth):
import clientapi_cpanel
from clientapi_cpanel.models.inline_response200318 import InlineResponse200318
from clientapi_cpanel.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://cpanel-server.tld:2083/execute
# See configuration.py for a list of all supported configuration parameters.
configuration = clientapi_cpanel.Configuration(
    host = "https://cpanel-server.tld:2083/execute"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: BasicAuth
configuration = clientapi_cpanel.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
with clientapi_cpanel.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = clientapi_cpanel.MimeTypeManagementApi(api_client)
    extension = '.foo' # str | The file extension.
    type = 'text/foo' # str | The MIME type.

    try:
        # Add MIME type to web server
        api_response = api_instance.add_mime(extension, type)
        print("The response of MimeTypeManagementApi->add_mime:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling MimeTypeManagementApi->add_mime: %s\n" % e)

Parameters

Name Type Description Notes
extension str The file extension.
type str The MIME type.

Return type

InlineResponse200318

Authorization

BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 HTTP Request was successful. -

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

delete_mime

InlineResponse200322 delete_mime(type)

Remove MIME type from web server

This function removes a MIME type from Apache.

Important:

When you disable the WebServer role, the system disables this function.

Example

  • Basic Authentication (BasicAuth):
import clientapi_cpanel
from clientapi_cpanel.models.inline_response200322 import InlineResponse200322
from clientapi_cpanel.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://cpanel-server.tld:2083/execute
# See configuration.py for a list of all supported configuration parameters.
configuration = clientapi_cpanel.Configuration(
    host = "https://cpanel-server.tld:2083/execute"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: BasicAuth
configuration = clientapi_cpanel.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
with clientapi_cpanel.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = clientapi_cpanel.MimeTypeManagementApi(api_client)
    type = 'text/foo' # str | The MIME type.

    try:
        # Remove MIME type from web server
        api_response = api_instance.delete_mime(type)
        print("The response of MimeTypeManagementApi->delete_mime:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling MimeTypeManagementApi->delete_mime: %s\n" % e)

Parameters

Name Type Description Notes
type str The MIME type.

Return type

InlineResponse200322

Authorization

BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 HTTP Request was successful. -

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

list_mime

InlineResponse200327 list_mime(type)

Return web server's MIME types

This function lists all of Apache's MIME types.

Note:

This function does not list PHP versions with MIME types when the user or domain enables PHP-FPM. The system displays only custom MIME types.

Important:

When you disable the Web Server role, the system disables this function.

Example

  • Basic Authentication (BasicAuth):
import clientapi_cpanel
from clientapi_cpanel.models.inline_response200327 import InlineResponse200327
from clientapi_cpanel.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://cpanel-server.tld:2083/execute
# See configuration.py for a list of all supported configuration parameters.
configuration = clientapi_cpanel.Configuration(
    host = "https://cpanel-server.tld:2083/execute"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: BasicAuth
configuration = clientapi_cpanel.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
with clientapi_cpanel.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = clientapi_cpanel.MimeTypeManagementApi(api_client)
    type = 'user' # str | The MIME types to list. * `system` — List the Apache system MIME types. * `user` — List the Apache user MIME types.

    try:
        # Return web server's MIME types
        api_response = api_instance.list_mime(type)
        print("The response of MimeTypeManagementApi->list_mime:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling MimeTypeManagementApi->list_mime: %s\n" % e)

Parameters

Name Type Description Notes
type str The MIME types to list. * `system` — List the Apache system MIME types. * `user` — List the Apache user MIME types.

Return type

InlineResponse200327

Authorization

BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 HTTP Request was successful. -

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