Skip to content

apidocs

ApiDocs API wrapper.

Attributes

APIDOCS_INDEX = 'https://static.apidocs.co/apidocs_index.json' module-attribute

APIDOCS_LOOKUP_TEMPLATE = 'https://api.apidocs.co/resolve/{app_name}/{app_version}/?asset_id={asset_type}:{asset_id}' module-attribute

APIDocsApp = namedtuple('APIDocsApp', ['apptitle', 'appslug', 'versionslug']) module-attribute

Functions

get_apps()

Returns a list of application available on apidocs.

Returns:

Type Description
list[APIDocsApp]

applictations documented on apidocs

Source code in pyrevitlib/pyrevit/coreutils/apidocs.py
def get_apps():
    """Returns a list of application available on apidocs.

    Returns:
        (list[APIDocsApp]): applictations documented on apidocs
    """
    apidoc_apps = []
    for app in json.loads(coreutils.read_url(APIDOCS_INDEX)):
        apidoc_apps.append(
            APIDocsApp(
                apptitle=app['apptitle'],
                appslug=app['appslug'],
                versionslug=app['versionslug']
            )
        )
    return apidoc_apps

make_namespace_uri(namespace, app_name='revit', app_version=str(HOST_APP.version))

Returns the URI of a namespace.

Parameters:

Name Type Description Default
namespace str

name of the namespace

required
app_name str

name of the application. Defaults to "revit".

'revit'
app_version str

version of the application. Defaults to str(HOST_APP.version).

str(version)

Returns:

Type Description
str

URI of the namespace

Source code in pyrevitlib/pyrevit/coreutils/apidocs.py
def make_namespace_uri(namespace,
                       app_name="revit",
                       app_version=str(HOST_APP.version)):
    """Returns the URI of a namespace.

    Args:
        namespace (str): name of the namespace
        app_name (str, optional): name of the application. Defaults to "revit".
        app_version (str, optional): version of the application. Defaults to str(HOST_APP.version).

    Returns:
        (str): URI of the namespace
    """
    return _make_uri(
        asset_type="N",
        asset_id=namespace,
        app_name=app_name,
        app_version=app_version,
        )

make_type_uri(type_name, app_name='revit', app_version=str(HOST_APP.version))

Returns the URI of a type.

Parameters:

Name Type Description Default
type_name str

name of the type

required
app_name str

name of the application. Defaults to "revit".

'revit'
app_version str

version of the application. Defaults to str(HOST_APP.version).

str(version)

Returns:

Type Description
str

URI of the type

Source code in pyrevitlib/pyrevit/coreutils/apidocs.py
def make_type_uri(type_name,
                  app_name="revit",
                  app_version=str(HOST_APP.version)):
    """Returns the URI of a type.

    Args:
        type_name (str): name of the type
        app_name (str, optional): name of the application. Defaults to "revit".
        app_version (str, optional): version of the application. Defaults to str(HOST_APP.version).

    Returns:
        (str): URI of the type
    """
    return _make_uri(
        asset_type="T",
        asset_id=type_name,
        app_name=app_name,
        app_version=app_version,
        )

make_event_uri(event_name, app_name='revit', app_version=str(HOST_APP.version))

Returns the URI of an event.

Parameters:

Name Type Description Default
event_name str

name of the event.

required
app_name str

name of the application. Defaults to "revit".

'revit'
app_version str

version of the application.

str(version)

Returns:

Type Description
str

URI of the event

Source code in pyrevitlib/pyrevit/coreutils/apidocs.py
def make_event_uri(event_name,
                   app_name="revit",
                   app_version=str(HOST_APP.version)):
    """Returns the URI of an event.

    Args:
        event_name (str): name of the event.
        app_name (str): name of the application. Defaults to "revit".
        app_version (str): version of the application.


    Returns:
        (str): URI of the event
    """
    return _make_uri(
        asset_type="E",
        asset_id=event_name,
        app_name=app_name,
        app_version=app_version,
        )