QualtricsAPI


NameQualtricsAPI JSON
Version 0.6.2 PyPI version JSON
download
home_pagehttps://github.com/Jaseibert/QualtricsAPI
SummaryQualtricsAPI is a lightweight Python library for the Qualtrics Web API.
upload_time2024-06-04 00:13:20
maintainerNone
docs_urlNone
authorJeremy Seibert
requires_pythonNone
licenseMIT
keywords qualtrics api python research survey
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # QualtricsAPI

[![Build Status](https://travis-ci.com/Jaseibert/QualtricsAPI.svg?branch=master)](https://travis-ci.com/Jaseibert/QualtricsAPI)
![PyPI](https://img.shields.io/pypi/v/QualtricsAPI)
![PyPI - Downloads](https://img.shields.io/pypi/dm/QualtricsAPI)

**Author:** [Jeremy Seibert](https://www.jeremyseibert.com)<br/>
**License:** [MIT](https://opensource.org/licenses/MIT)<br/>
**Package Documentation:** [Documentation](https://www.qualtricsapi-pydocs.com)<br/>

[Qualtrics](https://www.qualtrics.com) is an awesome company that builds software which gives users the ability to collect online data through online surveys. This python package, exists as a wrapper on top of the Qualtrics API. This package's primary goal is to be a super convenient way for python users to ingest, or upload their data from Qualtrics to their development environment, and vice versa.

Before we continue, I want to mention two things:

First, you must have Qualtrics API access in order to use this package. Contact whomever your Qualtrics Account Manager is for further clarification on your account's access credentials.

Secondly, this package is not affiliated with Qualtrics. Thus, I the author of this package, Jeremy Seibert, is not affiliated with Qualtrics, and Qualtrics does not offer support for this package. For specific information about the Qualtrics API, you can refer to their official documentation.

# R Users

For any R users there is an equally awesome package called ["qualtRics"](https://github.com/ropensci/qualtRics) which functions in very similar ways to this package. I have tried to keep consistent with some of the methods that are used in the qualtRics package and this one, so that there is a cohesion between the two. However, I don't believe that it supports functionality to work within the XM Contacts Data (i.e. the XMDirectory, or Mailing Lists). [CRAN]('https://cran.r-project.org/web/packages/qualtRics/index.html')

**Authors:** [Julia Silge](https://juliasilge.com/), [Jasper Ginn](http://www.jasperginn.io)<br/>
**License:** [MIT](https://opensource.org/licenses/MIT)

# Basic Usage

## Credentials Code Flow

We first create environment variables that will hold your API credentials, so you don't have to continually declare them. To do this we import the Credentials module, create and call the `qualtrics_api_credentials()`method.

```python
from QualtricsAPI.Setup import Credentials

#Call the qualtrics_api_credentials() method (Non-XM Directory Users)
Credentials().qualtrics_api_credentials(token='Your API Token',data_center='Your Data Center')

#Call the qualtrics_api_credentials() method (XM Directory Users)
Credentials().qualtrics_api_credentials(token='Your API Token',data_center='Your Data Center',directory_id='Your Directory ID')

```

This will generate environment variables that will be used to populate the HTTP headers which are necessary to make your API calls.

## Contact Data

Now the generation of the necessary HTTP headers will be handled automatically, so we don't have to worry about it. We have 2 modules available to work with Contact Data. The first is `XMDirectory()`, and `MailingList()`. We import each as follows below.

```python
from QualtricsAPI.XM import XMDirectory
from QualtricsAPI.XM import MailingList

#Create instances of each
x = XMDirectory()
m = MailingList()
```

Once imported, there are 10 methods that are available between both modules.

1. XMDirectory() Class Methods

```python
# Creates contacts in the XMDirectory
x.create_contact_in_XM()

#Deletes a contact in the XMDirectory (use cautiously!)
x.delete_contact()

#lists Contacts in the XMDirectory
x.list_contacts_in_directory()
```

2. MailingList() Class Methods

```python
#Creates a new Mailing list for the given Qualtrics User()
m.create_list()

#Lists the Mailing Lists for the given Qualtrics User()
m.list_lists()

#Gets the Attributes of the defined Mailing List
m.get_list()

#Renames the defined Mailing List
m.rename_list()

#Deletes a defined Mailing List (use cautiously!)
m.delete_list()

#Lists the contacts in the defined Mailing List
m.list_contacts()

#Creates contacts in a Mailing List
m.create_contact_in_list()
```

## Distributions Module

The `Distributions()` module has several useful methods.

```python
from QualtricsAPI.Survey import Distributions

d = Distributions()

# Create send dates
send_in_one_day = d.set_send_date(weeks=0, days=1, hours=0, minutes=0, seconds=0)
send_in_one_week = d.set_send_date(weeks=1, days=0, hours=0, minutes=0, seconds=0)

# Create a Survey Distribution
distribution_id = d.create_distribution(
    subject='Take our survey!',
    reply_email='no-reply@example.com',
    from_email='feedback@example.com',
    from_name='Example Co.',
    mailing_list='<mailing_list_id>',
    library='<library_id>',
    survey='<survey_id>',
    message='<message_id>',
    send_date=send_in_one_day
    link_type='Individual'
)

# Send a Reminder email distribution
d.create_reminder(
    subject='Reminder about your previous survey invitation',
    reply_email='no-reply@example.com',
    from_email='feedback@example.com',
    from_name='Example Co.',
    library='<library_id>',
    message='<message_id>',
    distribution=distribution_id,
    send_date=send_in_one_day
)

# Send a Thank you email
d.create_thank_you(
    subject='Thank you for taking our survey!',
    reply_email='no-reply@example.com',
    from_email='feedback@example.com',
    from_name='Example Co.',
    library='<library_id>',
    message='<message_id>',
    distribution=distribution_id,
    send_date=
)

# Get a list of distributions
d.list_distributions(survey='<survey_id>')

# Get a specific distribution
d.get_distribution(survey='<survey_id>', distribution=distribution_id)

#
d.create_sms_distribution(
    dist_name,
    mailing_list,
    library,
    survey,
    message,
    send_date,
    parentDistributionId=None,
    method='Invite'
)

```

## Survey Module

The `Responses()` module has two methods. Each of those methods can be called using the following methodology.

```python
from QualtricsAPI.Survey import Responses

#Get Survey Responses (Updated)
Responses().get_survey_responses(survey="<survey_id>", verify=None, **kwargs)

#Get Survey Questions (Updated)
Responses().get_survey_questions(survey="<survey_id>", verify=None, **kwargs)
```

# Wrap-up

Again this is currently under development so there may be reduced functionality, but I hope this helps fellow Qualtrics users to expedite their current workflow!

### Want to Contribute?

This project abides by the [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms. Feedback, bug reports (and fixes!), and feature requests are welcome!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Jaseibert/QualtricsAPI",
    "name": "QualtricsAPI",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "qualtrics api python research survey",
    "author": "Jeremy Seibert",
    "author_email": "jaseibert5@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5c/db/b69d5aa8f1abb84a94db149274f6fb4806b3c7d34f9b9ad8c29aee49e05c/qualtricsapi-0.6.2.tar.gz",
    "platform": null,
    "description": "# QualtricsAPI\n\n[![Build Status](https://travis-ci.com/Jaseibert/QualtricsAPI.svg?branch=master)](https://travis-ci.com/Jaseibert/QualtricsAPI)\n![PyPI](https://img.shields.io/pypi/v/QualtricsAPI)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/QualtricsAPI)\n\n**Author:** [Jeremy Seibert](https://www.jeremyseibert.com)<br/>\n**License:** [MIT](https://opensource.org/licenses/MIT)<br/>\n**Package Documentation:** [Documentation](https://www.qualtricsapi-pydocs.com)<br/>\n\n[Qualtrics](https://www.qualtrics.com) is an awesome company that builds software which gives users the ability to collect online data through online surveys. This python package, exists as a wrapper on top of the Qualtrics API. This package's primary goal is to be a super convenient way for python users to ingest, or upload their data from Qualtrics to their development environment, and vice versa.\n\nBefore we continue, I want to mention two things:\n\nFirst, you must have Qualtrics API access in order to use this package. Contact whomever your Qualtrics Account Manager is for further clarification on your account's access credentials.\n\nSecondly, this package is not affiliated with Qualtrics. Thus, I the author of this package, Jeremy Seibert, is not affiliated with Qualtrics, and Qualtrics does not offer support for this package. For specific information about the Qualtrics API, you can refer to their official documentation.\n\n# R Users\n\nFor any R users there is an equally awesome package called [\"qualtRics\"](https://github.com/ropensci/qualtRics) which functions in very similar ways to this package. I have tried to keep consistent with some of the methods that are used in the qualtRics package and this one, so that there is a cohesion between the two. However, I don't believe that it supports functionality to work within the XM Contacts Data (i.e. the XMDirectory, or Mailing Lists). [CRAN]('https://cran.r-project.org/web/packages/qualtRics/index.html')\n\n**Authors:** [Julia Silge](https://juliasilge.com/), [Jasper Ginn](http://www.jasperginn.io)<br/>\n**License:** [MIT](https://opensource.org/licenses/MIT)\n\n# Basic Usage\n\n## Credentials Code Flow\n\nWe first create environment variables that will hold your API credentials, so you don't have to continually declare them. To do this we import the Credentials module, create and call the `qualtrics_api_credentials()`method.\n\n```python\nfrom QualtricsAPI.Setup import Credentials\n\n#Call the qualtrics_api_credentials() method (Non-XM Directory Users)\nCredentials().qualtrics_api_credentials(token='Your API Token',data_center='Your Data Center')\n\n#Call the qualtrics_api_credentials() method (XM Directory Users)\nCredentials().qualtrics_api_credentials(token='Your API Token',data_center='Your Data Center',directory_id='Your Directory ID')\n\n```\n\nThis will generate environment variables that will be used to populate the HTTP headers which are necessary to make your API calls.\n\n## Contact Data\n\nNow the generation of the necessary HTTP headers will be handled automatically, so we don't have to worry about it. We have 2 modules available to work with Contact Data. The first is `XMDirectory()`, and `MailingList()`. We import each as follows below.\n\n```python\nfrom QualtricsAPI.XM import XMDirectory\nfrom QualtricsAPI.XM import MailingList\n\n#Create instances of each\nx = XMDirectory()\nm = MailingList()\n```\n\nOnce imported, there are 10 methods that are available between both modules.\n\n1. XMDirectory() Class Methods\n\n```python\n# Creates contacts in the XMDirectory\nx.create_contact_in_XM()\n\n#Deletes a contact in the XMDirectory (use cautiously!)\nx.delete_contact()\n\n#lists Contacts in the XMDirectory\nx.list_contacts_in_directory()\n```\n\n2. MailingList() Class Methods\n\n```python\n#Creates a new Mailing list for the given Qualtrics User()\nm.create_list()\n\n#Lists the Mailing Lists for the given Qualtrics User()\nm.list_lists()\n\n#Gets the Attributes of the defined Mailing List\nm.get_list()\n\n#Renames the defined Mailing List\nm.rename_list()\n\n#Deletes a defined Mailing List (use cautiously!)\nm.delete_list()\n\n#Lists the contacts in the defined Mailing List\nm.list_contacts()\n\n#Creates contacts in a Mailing List\nm.create_contact_in_list()\n```\n\n## Distributions Module\n\nThe `Distributions()` module has several useful methods.\n\n```python\nfrom QualtricsAPI.Survey import Distributions\n\nd = Distributions()\n\n# Create send dates\nsend_in_one_day = d.set_send_date(weeks=0, days=1, hours=0, minutes=0, seconds=0)\nsend_in_one_week = d.set_send_date(weeks=1, days=0, hours=0, minutes=0, seconds=0)\n\n# Create a Survey Distribution\ndistribution_id = d.create_distribution(\n    subject='Take our survey!',\n    reply_email='no-reply@example.com',\n    from_email='feedback@example.com',\n    from_name='Example Co.',\n    mailing_list='<mailing_list_id>',\n    library='<library_id>',\n    survey='<survey_id>',\n    message='<message_id>',\n    send_date=send_in_one_day\n    link_type='Individual'\n)\n\n# Send a Reminder email distribution\nd.create_reminder(\n    subject='Reminder about your previous survey invitation',\n    reply_email='no-reply@example.com',\n    from_email='feedback@example.com',\n    from_name='Example Co.',\n    library='<library_id>',\n    message='<message_id>',\n    distribution=distribution_id,\n    send_date=send_in_one_day\n)\n\n# Send a Thank you email\nd.create_thank_you(\n    subject='Thank you for taking our survey!',\n    reply_email='no-reply@example.com',\n    from_email='feedback@example.com',\n    from_name='Example Co.',\n    library='<library_id>',\n    message='<message_id>',\n    distribution=distribution_id,\n    send_date=\n)\n\n# Get a list of distributions\nd.list_distributions(survey='<survey_id>')\n\n# Get a specific distribution\nd.get_distribution(survey='<survey_id>', distribution=distribution_id)\n\n#\nd.create_sms_distribution(\n    dist_name,\n    mailing_list,\n    library,\n    survey,\n    message,\n    send_date,\n    parentDistributionId=None,\n    method='Invite'\n)\n\n```\n\n## Survey Module\n\nThe `Responses()` module has two methods. Each of those methods can be called using the following methodology.\n\n```python\nfrom QualtricsAPI.Survey import Responses\n\n#Get Survey Responses (Updated)\nResponses().get_survey_responses(survey=\"<survey_id>\", verify=None, **kwargs)\n\n#Get Survey Questions (Updated)\nResponses().get_survey_questions(survey=\"<survey_id>\", verify=None, **kwargs)\n```\n\n# Wrap-up\n\nAgain this is currently under development so there may be reduced functionality, but I hope this helps fellow Qualtrics users to expedite their current workflow!\n\n### Want to Contribute?\n\nThis project abides by the [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms. Feedback, bug reports (and fixes!), and feature requests are welcome!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "QualtricsAPI is a lightweight Python library for the Qualtrics Web API.",
    "version": "0.6.2",
    "project_urls": {
        "Homepage": "https://github.com/Jaseibert/QualtricsAPI"
    },
    "split_keywords": [
        "qualtrics",
        "api",
        "python",
        "research",
        "survey"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a48909a67cf562e8f88bae5dfe67087b3f28b59427737fb8cdeeae41bae174ae",
                "md5": "08bd22df438605be1ab00ea0a6eaa4eb",
                "sha256": "bd0b94ad4063cdc4859c9ca00926387a19bd2ab2b3e3886590e2f40484df1e4d"
            },
            "downloads": -1,
            "filename": "QualtricsAPI-0.6.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08bd22df438605be1ab00ea0a6eaa4eb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 35246,
            "upload_time": "2024-06-04T00:13:18",
            "upload_time_iso_8601": "2024-06-04T00:13:18.448691Z",
            "url": "https://files.pythonhosted.org/packages/a4/89/09a67cf562e8f88bae5dfe67087b3f28b59427737fb8cdeeae41bae174ae/QualtricsAPI-0.6.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5cdbb69d5aa8f1abb84a94db149274f6fb4806b3c7d34f9b9ad8c29aee49e05c",
                "md5": "dd720735450dcc63c88e380aadf4de8d",
                "sha256": "0bb7d7afa29d620bdc1d42db3b34db8d9acaa8bcc4a54772e0a682ee4852dc7d"
            },
            "downloads": -1,
            "filename": "qualtricsapi-0.6.2.tar.gz",
            "has_sig": false,
            "md5_digest": "dd720735450dcc63c88e380aadf4de8d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 30255,
            "upload_time": "2024-06-04T00:13:20",
            "upload_time_iso_8601": "2024-06-04T00:13:20.283959Z",
            "url": "https://files.pythonhosted.org/packages/5c/db/b69d5aa8f1abb84a94db149274f6fb4806b3c7d34f9b9ad8c29aee49e05c/qualtricsapi-0.6.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-04 00:13:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Jaseibert",
    "github_project": "QualtricsAPI",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "qualtricsapi"
}
        
Elapsed time: 4.12950s