-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Original issue posted in: InterNetX/js-domainrobot-sdk#114
In a generated OpenAPI client, authentication does not work, as the authorization information is missing. This in turn leads to the authentication information not being sent.
Generating the OpenAPI client despite specification errors
openapi-generator-cli generate -g python --skip-validate-spec -i https://raw.githubusercontent.com/InterNetX/internetx-swagger-files/master/src/domainrobot.jsonSetting Up the OpenAPI client
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.autodns.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://api.autodns.com/v1"
username = "username"
password = "password"
)Setting a password in the client configuration like in the example above has no effect, due to the missing authorization data in the specification, which is visible in the generated documentation, seen below. Any API calls requiring authentication lead to a 401 error, despite username and password being set.
contact_create
JsonResponseDataContact contact_create(x_domainrobot_domain_safe_pin=x_domainrobot_domain_safe_pin, x_domainrobot_domain_safe_transaction=x_domainrobot_domain_safe_transaction, x_domainrobot_domain_safe_transaction_expire=x_domainrobot_domain_safe_transaction_expire, x_domainrobot_domain_safe_tan=x_domainrobot_domain_safe_tan, x_domainrobot_owner_user=x_domainrobot_owner_user, x_domainrobot_owner_context=x_domainrobot_owner_context, x_domainrobot_demo=x_domainrobot_demo, x_domainrobot_session_id=x_domainrobot_session_id, x_domainrobot_context=x_domainrobot_context, x_domainrobot_ws=x_domainrobot_ws, x_domainrobot_bulk_limit=x_domainrobot_bulk_limit, x_domainrobot_2_fa_token=x_domainrobot_2_fa_token, keys=keys, contact=contact)
Contact Create (0301)
Creating a new domain contact.
Example
import openapi_client
from openapi_client.models.contact import Contact
from openapi_client.models.json_response_data_contact import JsonResponseDataContact
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.autodns.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://api.autodns.com/v1"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.ContactTasksApi(api_client)
x_domainrobot_domain_safe_pin = 'x_domainrobot_domain_safe_pin_example' # str | (optional)
x_domainrobot_domain_safe_transaction = 'x_domainrobot_domain_safe_transaction_example' # str | (optional)
x_domainrobot_domain_safe_transaction_expire = '2013-10-20T19:20:30+01:00' # datetime | (optional)
x_domainrobot_domain_safe_tan = 'x_domainrobot_domain_safe_tan_example' # str | (optional)
x_domainrobot_owner_user = 'x_domainrobot_owner_user_example' # str | (optional)
x_domainrobot_owner_context = 56 # int | (optional)
x_domainrobot_demo = True # bool | (optional)
x_domainrobot_session_id = 'x_domainrobot_session_id_example' # str | (optional)
x_domainrobot_context = 56 # int | (optional)
x_domainrobot_ws = 'x_domainrobot_ws_example' # str | (optional)
x_domainrobot_bulk_limit = 56 # int | (optional)
x_domainrobot_2_fa_token = 56 # int | (optional)
keys = ['?keys[]=force_handle_create'] # List[str] | The query parameter wich enables the force mode if the key is set. (optional)
contact = openapi_client.Contact() # Contact | (optional)
try:
# Contact Create (0301)
api_response = api_instance.contact_create(x_domainrobot_domain_safe_pin=x_domainrobot_domain_safe_pin, x_domainrobot_domain_safe_transaction=x_domainrobot_domain_safe_transaction, x_domainrobot_domain_safe_transaction_expire=x_domainrobot_domain_safe_transaction_expire, x_domainrobot_domain_safe_tan=x_domainrobot_domain_safe_tan, x_domainrobot_owner_user=x_domainrobot_owner_user, x_domainrobot_owner_context=x_domainrobot_owner_context, x_domainrobot_demo=x_domainrobot_demo, x_domainrobot_session_id=x_domainrobot_session_id, x_domainrobot_context=x_domainrobot_context, x_domainrobot_ws=x_domainrobot_ws, x_domainrobot_bulk_limit=x_domainrobot_bulk_limit, x_domainrobot_2_fa_token=x_domainrobot_2_fa_token, keys=keys, contact=contact)
print("The response of ContactTasksApi->contact_create:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ContactTasksApi->contact_create: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| x_domainrobot_domain_safe_pin | str | [optional] | |
| x_domainrobot_domain_safe_transaction | str | [optional] | |
| x_domainrobot_domain_safe_transaction_expire | datetime | [optional] | |
| x_domainrobot_domain_safe_tan | str | [optional] | |
| x_domainrobot_owner_user | str | [optional] | |
| x_domainrobot_owner_context | int | [optional] | |
| x_domainrobot_demo | bool | [optional] | |
| x_domainrobot_session_id | str | [optional] | |
| x_domainrobot_context | int | [optional] | |
| x_domainrobot_ws | str | [optional] | |
| x_domainrobot_bulk_limit | int | [optional] | |
| x_domainrobot_2_fa_token | int | [optional] | |
| keys | List[str] | The query parameter wich enables the force mode if the key is set. | [optional] |
| contact | Contact | [optional] |
Return type
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | successful operation | - |