Authentication overview

QuickMocker secures access to its management API primarily through API keys. These keys serve as a credential for authenticating requests made to the QuickMocker platform, allowing users to programmatically interact with their mock APIs and configurations. This method is suitable for automated scripts, continuous integration/continuous deployment (CI/CD) pipelines, and custom tools that manage QuickMocker resources without manual intervention. All API interactions are expected to occur over HTTPS to ensure the confidentiality and integrity of data in transit, aligning with standard API security practices recommended by organizations like the Internet Engineering Task Force (IETF) for HTTP communication.

The QuickMocker API allows for actions such as creating new mock APIs, defining endpoints, and configuring responses. Proper authentication ensures that only authorized users can perform these operations, protecting user data and preventing unauthorized changes to mock environments. The API key model provides a balance between ease of use for developers and necessary security controls for programmatic access.

Supported authentication methods

QuickMocker's API primarily supports authentication via a unique API key. This key is a long, randomly generated string that identifies your user account and grants access to your resources.

API Key Authentication

  • Mechanism: The API key is typically sent in the Authorization header of HTTP requests.
  • How it works: When you make a request to the QuickMocker API, you include your API key in the specified header. The QuickMocker server then verifies this key against its records to confirm your identity and authorization level.
  • Scopes/Permissions: QuickMocker API keys provide full access to the resources associated with your user account. There are no granular scopes (e.g., read-only vs. read-write) available for API keys; they grant comprehensive management capabilities. Users are advised to treat their API keys as sensitive credentials.

The following table summarizes QuickMocker's supported authentication method:

Method When to Use Security Level
API Key (Header) Programmatic access, CI/CD pipelines, scripting, integrations Moderate (requires secure storage and transmission via HTTPS)

Other common authentication methods, such as OAuth 2.0 or mutual TLS (mTLS), are not explicitly supported for accessing the QuickMocker management API. OAuth 2.0, for instance, is often used for delegated authorization in third-party applications, as detailed by the OAuth 2.0 framework. However, for direct programmatic interaction with QuickMocker, the API key remains the standard.

Getting your credentials

To obtain your QuickMocker API key, follow these steps:

  1. Log In: Navigate to the QuickMocker website and log in to your account.
  2. Access Account Settings: Once logged in, locate and click on your profile icon or username, typically in the top-right corner of the dashboard. From the dropdown menu, select "Account Settings" or a similar option.
  3. Find API Key Section: Within your account settings, look for a section labeled "API Keys," "Developer Settings," or "Integrations."
  4. Generate/View API Key: If you haven't generated a key before, there will be an option to "Generate API Key." If you have an existing key, it might be displayed (partially masked) with an option to reveal or regenerate it. Click the appropriate button to get your key.
  5. Copy Your Key: Carefully copy the generated API key. It is crucial to store this key securely, as it grants access to your QuickMocker resources. Once you navigate away from the page or regenerate the key, the old key may become invalid, or you may not be able to retrieve the full string again. QuickMocker's official documentation provides further guidance on managing your keys.

Remember that your API key is sensitive information. Treat it like a password and avoid hardcoding it directly into your frontend applications or public repositories.

Authenticated request example

When making requests to the QuickMocker API, you must include your API key in the Authorization header with the Bearer scheme. The base URL for the QuickMocker API is provided in their API reference documentation.

Here's an example of how to authenticate a request using curl to list your mock APIs:

curl -X GET \
  'https://quickmocker.com/api/v1/mocks' \
  -H 'Authorization: Bearer YOUR_QUICKMOCKER_API_KEY' \
  -H 'Content-Type: application/json'

Replace YOUR_QUICKMOCKER_API_KEY with the actual API key you obtained from your QuickMocker account settings.

In a Python application using the requests library, an authenticated request would look like this:

import requests

api_key = 'YOUR_QUICKMOCKER_API_KEY'
headers = {
    'Authorization': f'Bearer {api_key}',
    'Content-Type': 'application/json'
}

url = 'https://quickmocker.com/api/v1/mocks'

response = requests.get(url, headers=headers)

if response.status_code == 200:
    print('Successfully retrieved mock APIs:')
    print(response.json())
else:
    print(f'Error: {response.status_code} - {response.text}')

These examples demonstrate the correct way to include your API key for successful authentication with the QuickMocker API.

Security best practices

Securing your QuickMocker API key is essential to prevent unauthorized access to your mock environments and data. Adhere to these best practices:

  1. Treat API Keys as Passwords: Your API key provides full access to your QuickMocker resources. Never embed it directly in client-side code (e.g., JavaScript in a web browser) or publicly accessible repositories.
  2. Use Environment Variables: For server-side applications, scripts, or CI/CD pipelines, store your API key as an environment variable. This keeps the key out of your codebase and allows for easier rotation without code changes. For example, in Bash, you might use export QUICKMOCKER_API_KEY="your_key_here".
  3. Secure Storage: If you must store the key, use secure storage mechanisms like secret management services (e.g., AWS Secrets Manager, Google Secret Manager), encrypted configuration files, or a password manager. Avoid plain-text storage.
  4. Restrict Access: Limit who has access to your API key. Only individuals or systems that absolutely require programmatic access to QuickMocker should have it.
  5. Regular Key Rotation: Periodically regenerate your API key from your QuickMocker account settings. This practice reduces the risk associated with a compromised key over time. If you suspect a key has been compromised, regenerate it immediately.
  6. Use HTTPS: Always ensure that all API requests are made over HTTPS. QuickMocker enforces this, but it's a fundamental security principle for any API interaction to protect credentials and data from interception during transit.
  7. Monitor Usage: While QuickMocker may not offer extensive audit logs for API key usage, monitoring your QuickMocker account for unexpected changes or resource creation can help detect unauthorized activity.

By implementing these security measures, you can significantly reduce the risk of unauthorized access to your QuickMocker account and maintain the integrity of your mock API configurations. These practices align with general API security recommendations from industry experts, including those provided by cloud providers like AWS on managing access keys.