Skip to content

Version

REDCap API methods for Project REDCap version

Version (Base)

Responsible for all API methods under 'REDCap' in the API Playground

Source code in redcap/methods/version.py
class Version(Base):
    """Responsible for all API methods under 'REDCap' in the API Playground"""

    def export_version(self) -> Optional[semantic_version.Version]:
        """
        Get the REDCap version

        Returns:
            REDCap version running on the url provided

        Examples:
            >>> import semantic_version
            >>> redcap_version = proj.export_version()
            >>> assert redcap_version >= semantic_version.Version("12.0.1")
        """
        payload = self._initialize_payload("version")
        resp = None

        redcap_version = self._call_api(payload, return_type="str")

        if semantic_version.validate(redcap_version):
            resp = semantic_version.Version(redcap_version)

        return resp

def_field: str inherited property readonly

The 'record_id' field equivalent for a project

field_names: List[str] inherited property readonly

Project field names

!!! note These are survey field names, not export field names

forms: List[str] inherited property readonly

Project form names

is_longitudinal: bool inherited property readonly

Whether or not this project is longitudinal

metadata: Json inherited property readonly

Project metadata in JSON format

token: str inherited property readonly

API token to a project

url: str inherited property readonly

API URL to a REDCap server

export_version(self)

Get the REDCap version

Returns:

Type Description
Optional[semantic_version.base.Version]

REDCap version running on the url provided

Examples:

>>> import semantic_version
>>> redcap_version = proj.export_version()
>>> assert redcap_version >= semantic_version.Version("12.0.1")
Source code in redcap/methods/version.py
def export_version(self) -> Optional[semantic_version.Version]:
    """
    Get the REDCap version

    Returns:
        REDCap version running on the url provided

    Examples:
        >>> import semantic_version
        >>> redcap_version = proj.export_version()
        >>> assert redcap_version >= semantic_version.Version("12.0.1")
    """
    payload = self._initialize_payload("version")
    resp = None

    redcap_version = self._call_api(payload, return_type="str")

    if semantic_version.validate(redcap_version):
        resp = semantic_version.Version(redcap_version)

    return resp