Templates

class Templates(session_kwargs, client, return_type='raw')

Examples

>>> import civis
>>> client = civis.APIClient()
>>> client.templates.list_reports_shares(...)

Methods

delete_reports_shares_groups(id, group_id)

Revoke the permissions a group has on this object

delete_reports_shares_users(id, user_id)

Revoke the permissions a user has on this object

delete_scripts_projects(id, project_id)

Remove a Script Template from a project

delete_scripts_shares_groups(id, group_id)

Revoke the permissions a group has on this object

delete_scripts_shares_users(id, user_id)

Revoke the permissions a user has on this object

get_reports(id)

Get a Report Template

get_scripts(id)

Get a Script Template

list_reports(*[, hidden, author, category, ...])

List Report Templates

list_reports_dependencies(id, *[, user_id])

List dependent objects for this object

list_reports_shares(id)

List users and groups permissioned on this object

list_scripts(*[, hidden, author, category, ...])

List Script Templates

list_scripts_dependencies(id, *[, user_id])

List dependent objects for this object

list_scripts_projects(id, *[, hidden])

List the projects a Script Template belongs to

list_scripts_shares(id)

List users and groups permissioned on this object

patch_reports(id, *[, name, category, ...])

Update some attributes of this Report Template

patch_scripts(id, *[, name, note, ...])

Update some attributes of this Script Template

post_reports(name, code_body, *[, category, ...])

Create a Report Template

post_scripts(script_id, name, *[, note, ...])

Create a Script Template

put_reports(id, name, code_body, *[, ...])

Replace all attributes of this Report Template

put_reports_shares_groups(id, group_ids, ...)

Set the permissions groups has on this object

put_reports_shares_users(id, user_ids, ...)

Set the permissions users have on this object

put_reports_transfer(id, user_id, ...[, ...])

Transfer ownership of this object to another user

put_scripts(id, name, *[, note, ...])

Replace all attributes of this Script Template

put_scripts_projects(id, project_id)

Add a Script Template to a project

put_scripts_shares_groups(id, group_ids, ...)

Set the permissions groups has on this object

put_scripts_shares_users(id, user_ids, ...)

Set the permissions users have on this object

put_scripts_transfer(id, user_id, ...[, ...])

Transfer ownership of this object to another user

delete_reports_shares_groups(id: int, group_id: int)

Revoke the permissions a group has on this object

Parameters:
idint

The ID of the resource that is shared.

group_idint

The ID of the group.

Returns:
None

Response code 204: success

delete_reports_shares_users(id: int, user_id: int)

Revoke the permissions a user has on this object

Parameters:
idint

The ID of the resource that is shared.

user_idint

The ID of the user.

Returns:
None

Response code 204: success

delete_scripts_projects(id: int, project_id: int)

Remove a Script Template from a project

Parameters:
idint

The ID of the Script Template.

project_idint

The ID of the project.

Returns:
None

Response code 204: success

delete_scripts_shares_groups(id: int, group_id: int)

Revoke the permissions a group has on this object

Parameters:
idint

The ID of the resource that is shared.

group_idint

The ID of the group.

Returns:
None

Response code 204: success

delete_scripts_shares_users(id: int, user_id: int)

Revoke the permissions a user has on this object

Parameters:
idint

The ID of the resource that is shared.

user_idint

The ID of the user.

Returns:
None

Response code 204: success

get_reports(id: int)

Get a Report Template

Parameters:
idint
Returns:
civis.response.Response
  • id : int

  • namestr

    The name of the template.

  • categorystr

    The category of this report template. Can be left blank. Acceptable values are: dataset-viz

  • created_at : str (time)

  • updated_at : str (time)

  • use_countint

    The number of uses of this template.

  • archivedbool

    Whether the template has been archived.

  • tech_reviewedbool

    Whether this template has been audited by Civis for security vulnerability and correctness.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • auth_code_urlstr

    A URL to the template’s stored code body.

  • provide_api_keybool

    Whether reports based on this template request an API Key from the report viewer.

  • hiddenbool

    The hidden status of the item.

get_scripts(id: int)

Get a Script Template

Parameters:
idint
Returns:
civis.response.Response
  • id : int

  • publicbool

    If the template is public or not.

  • script_idint

    The id of the script that this template uses.

  • script_typestr

    The type of the template’s backing script (e.g SQL, Container, Python, R, JavaScript)

  • user_contextstr

    The user context of the script that this template uses.

  • paramsList[dict]

    A definition of the parameters that this template’s backing script accepts in the arguments field.

    • namestr

      The variable’s name as used within your code.

    • labelstr

      The label to present to users when asking them for the value.

    • descriptionstr

      A short sentence or fragment describing this parameter to the end user.

    • typestr

      The type of parameter. Valid options: string, multi_line_string, integer, float, bool, file, table, database, credential_aws, credential_redshift, or credential_custom

    • requiredbool

      Whether this param is required.

    • valuestr

      The value you would like to set this param to. Setting this value makes this parameter a fixed param.

    • defaultstr

      If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool’s or false, False, f, n, no, or 0 for false bool’s. Cannot be used for parameters that are required or a credential type.

    • allowed_valuesList[dict]

      The possible values this parameter can take, effectively making this an enumerable parameter. Allowed values is an array of hashes of the following format: {label: ‘Import’, ‘value’: ‘import’}

  • namestr

    The name of the template.

  • categorystr

    The category of this template.

  • notestr

    A note describing what this template is used for; custom scripts created off this template will display this description.

  • created_at : str (time)

  • updated_at : str (time)

  • use_countint

    The number of uses of this template.

  • ui_report_idint

    The id of the report that this template uses.

  • tech_reviewedbool

    Whether this template has been audited by Civis for security vulnerability and correctness.

  • archivedbool

    Whether the template has been archived.

  • hiddenbool

    The hidden status of the item.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

list_reports(*, hidden: bool = None, author: str = None, category: str = None, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None)

List Report Templates

Parameters:
hiddenbool, optional

If specified to be true, returns hidden items. Defaults to false, returning non-hidden items.

authorstr, optional

If specified, return items from any of these authors. It accepts a comma- separated list of user IDs.

categorystr, optional

A category to filter results by, one of: dataset-viz

limitint, optional

Number of results to return. Defaults to 50. Maximum allowed is 1000.

page_numint, optional

Page number of the results to return. Defaults to the first page, 1.

orderstr, optional

The field on which to order the result set. Defaults to name. Must be one of: name, updated_at, created_at.

order_dirstr, optional

Direction in which to sort, either asc (ascending) or desc (descending) defaulting to asc.

iteratorbool, optional

If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.

Returns:
civis.response.PaginatedResponse
  • id : int

  • namestr

    The name of the template.

  • categorystr

    The category of this report template. Can be left blank. Acceptable values are: dataset-viz

  • created_at : str (time)

  • updated_at : str (time)

  • use_countint

    The number of uses of this template.

  • archivedbool

    Whether the template has been archived.

  • tech_reviewedbool

    Whether this template has been audited by Civis for security vulnerability and correctness.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

list_reports_dependencies(id: int, *, user_id: int = None)

List dependent objects for this object

Parameters:
idint

The ID of the resource that is shared.

user_idint, optional

ID of target user

Returns:
civis.response.Response
  • object_typestr

    Dependent object type

  • fco_typestr

    Human readable dependent object type

  • idint

    Dependent object ID

  • namestr

    Dependent object name, or nil if the requesting user cannot read this object

  • permission_levelstr

    Permission level of target user (not user’s groups) for dependent object. Null if no target user or not shareable (e.g. a database table).

  • descriptionstr

    Additional information about the dependency, if relevant

  • shareablebool

    Whether or not the requesting user can share this object.

list_reports_shares(id: int)

List users and groups permissioned on this object

Parameters:
idint

The ID of the resource that is shared.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

list_scripts(*, hidden: bool = None, author: str = None, category: str = None, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None)

List Script Templates

Parameters:
hiddenbool, optional

If specified to be true, returns hidden items. Defaults to false, returning non-hidden items.

authorstr, optional

If specified, return items from any of these authors. It accepts a comma- separated list of user IDs.

categorystr, optional

A category to filter results by, one of: import, export, enhancement, model, and script

limitint, optional

Number of results to return. Defaults to 50. Maximum allowed is 1000.

page_numint, optional

Page number of the results to return. Defaults to the first page, 1.

orderstr, optional

The field on which to order the result set. Defaults to name. Must be one of: name, updated_at, created_at.

order_dirstr, optional

Direction in which to sort, either asc (ascending) or desc (descending) defaulting to asc.

iteratorbool, optional

If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.

Returns:
civis.response.PaginatedResponse
  • id : int

  • publicbool

    If the template is public or not.

  • script_idint

    The id of the script that this template uses.

  • user_contextstr

    The user context of the script that this template uses.

  • namestr

    The name of the template.

  • categorystr

    The category of this template.

  • created_at : str (time)

  • updated_at : str (time)

  • use_countint

    The number of uses of this template.

  • ui_report_idint

    The id of the report that this template uses.

  • tech_reviewedbool

    Whether this template has been audited by Civis for security vulnerability and correctness.

  • archivedbool

    Whether the template has been archived.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

list_scripts_dependencies(id: int, *, user_id: int = None)

List dependent objects for this object

Parameters:
idint

The ID of the resource that is shared.

user_idint, optional

ID of target user

Returns:
civis.response.Response
  • object_typestr

    Dependent object type

  • fco_typestr

    Human readable dependent object type

  • idint

    Dependent object ID

  • namestr

    Dependent object name, or nil if the requesting user cannot read this object

  • permission_levelstr

    Permission level of target user (not user’s groups) for dependent object. Null if no target user or not shareable (e.g. a database table).

  • descriptionstr

    Additional information about the dependency, if relevant

  • shareablebool

    Whether or not the requesting user can share this object.

list_scripts_projects(id: int, *, hidden: bool = None)

List the projects a Script Template belongs to

Parameters:
idint

The ID of the Script Template.

hiddenbool, optional

If specified to be true, returns hidden items. Defaults to false, returning non-hidden items.

Returns:
civis.response.Response
  • idint

    The ID for this project.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • namestr

    The name of this project.

  • descriptionstr

    A description of the project.

  • usersList[dict]

    Users who can see the project.

    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • auto_share : bool

  • created_at : str (time)

  • updated_at : str (time)

  • archivedstr

    The archival status of the requested item(s).

list_scripts_shares(id: int)

List users and groups permissioned on this object

Parameters:
idint

The ID of the resource that is shared.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

patch_reports(id: int, *, name: str = None, category: str = None, archived: bool = None, code_body: str = None, provide_api_key: bool = None)

Update some attributes of this Report Template

Parameters:
idint
namestr, optional

The name of the template.

categorystr, optional

The category of this report template. Can be left blank. Acceptable values are: dataset-viz

archivedbool, optional

Whether the template has been archived.

code_bodystr, optional

The code for the Template body.

provide_api_keybool, optional

Whether reports based on this template request an API Key from the report viewer.

Returns:
civis.response.Response
  • id : int

  • namestr

    The name of the template.

  • categorystr

    The category of this report template. Can be left blank. Acceptable values are: dataset-viz

  • created_at : str (time)

  • updated_at : str (time)

  • use_countint

    The number of uses of this template.

  • archivedbool

    Whether the template has been archived.

  • tech_reviewedbool

    Whether this template has been audited by Civis for security vulnerability and correctness.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • auth_code_urlstr

    A URL to the template’s stored code body.

  • provide_api_keybool

    Whether reports based on this template request an API Key from the report viewer.

  • hiddenbool

    The hidden status of the item.

patch_scripts(id: int, *, name: str = None, note: str = None, ui_report_id: int = None, archived: bool = None)

Update some attributes of this Script Template

Parameters:
idint
namestr, optional

The name of the template.

notestr, optional

A note describing what this template is used for; custom scripts created off this template will display this description.

ui_report_idint, optional

The id of the report that this template uses.

archivedbool, optional

Whether the template has been archived.

Returns:
civis.response.Response
  • id : int

  • publicbool

    If the template is public or not.

  • script_idint

    The id of the script that this template uses.

  • script_typestr

    The type of the template’s backing script (e.g SQL, Container, Python, R, JavaScript)

  • user_contextstr

    The user context of the script that this template uses.

  • paramsList[dict]

    A definition of the parameters that this template’s backing script accepts in the arguments field.

    • namestr

      The variable’s name as used within your code.

    • labelstr

      The label to present to users when asking them for the value.

    • descriptionstr

      A short sentence or fragment describing this parameter to the end user.

    • typestr

      The type of parameter. Valid options: string, multi_line_string, integer, float, bool, file, table, database, credential_aws, credential_redshift, or credential_custom

    • requiredbool

      Whether this param is required.

    • valuestr

      The value you would like to set this param to. Setting this value makes this parameter a fixed param.

    • defaultstr

      If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool’s or false, False, f, n, no, or 0 for false bool’s. Cannot be used for parameters that are required or a credential type.

    • allowed_valuesList[dict]

      The possible values this parameter can take, effectively making this an enumerable parameter. Allowed values is an array of hashes of the following format: {label: ‘Import’, ‘value’: ‘import’}

  • namestr

    The name of the template.

  • categorystr

    The category of this template.

  • notestr

    A note describing what this template is used for; custom scripts created off this template will display this description.

  • created_at : str (time)

  • updated_at : str (time)

  • use_countint

    The number of uses of this template.

  • ui_report_idint

    The id of the report that this template uses.

  • tech_reviewedbool

    Whether this template has been audited by Civis for security vulnerability and correctness.

  • archivedbool

    Whether the template has been archived.

  • hiddenbool

    The hidden status of the item.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

post_reports(name: str, code_body: str, *, category: str = None, archived: bool = None, provide_api_key: bool = None, hidden: bool = None)

Create a Report Template

Parameters:
namestr

The name of the template.

code_bodystr

The code for the Template body.

categorystr, optional

The category of this report template. Can be left blank. Acceptable values are: dataset-viz

archivedbool, optional

Whether the template has been archived.

provide_api_keybool, optional

Whether reports based on this template request an API Key from the report viewer.

hiddenbool, optional

The hidden status of the item.

Returns:
civis.response.Response
  • id : int

  • namestr

    The name of the template.

  • categorystr

    The category of this report template. Can be left blank. Acceptable values are: dataset-viz

  • created_at : str (time)

  • updated_at : str (time)

  • use_countint

    The number of uses of this template.

  • archivedbool

    Whether the template has been archived.

  • tech_reviewedbool

    Whether this template has been audited by Civis for security vulnerability and correctness.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • auth_code_urlstr

    A URL to the template’s stored code body.

  • provide_api_keybool

    Whether reports based on this template request an API Key from the report viewer.

  • hiddenbool

    The hidden status of the item.

post_scripts(script_id: int, name: str, *, note: str = None, ui_report_id: int = None, archived: bool = None, hidden: bool = None)

Create a Script Template

Parameters:
script_idint

The id of the script that this template uses.

namestr

The name of the template.

notestr, optional

A note describing what this template is used for; custom scripts created off this template will display this description.

ui_report_idint, optional

The id of the report that this template uses.

archivedbool, optional

Whether the template has been archived.

hiddenbool, optional

The hidden status of the item.

Returns:
civis.response.Response
  • id : int

  • publicbool

    If the template is public or not.

  • script_idint

    The id of the script that this template uses.

  • script_typestr

    The type of the template’s backing script (e.g SQL, Container, Python, R, JavaScript)

  • user_contextstr

    The user context of the script that this template uses.

  • paramsList[dict]

    A definition of the parameters that this template’s backing script accepts in the arguments field.

    • namestr

      The variable’s name as used within your code.

    • labelstr

      The label to present to users when asking them for the value.

    • descriptionstr

      A short sentence or fragment describing this parameter to the end user.

    • typestr

      The type of parameter. Valid options: string, multi_line_string, integer, float, bool, file, table, database, credential_aws, credential_redshift, or credential_custom

    • requiredbool

      Whether this param is required.

    • valuestr

      The value you would like to set this param to. Setting this value makes this parameter a fixed param.

    • defaultstr

      If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool’s or false, False, f, n, no, or 0 for false bool’s. Cannot be used for parameters that are required or a credential type.

    • allowed_valuesList[dict]

      The possible values this parameter can take, effectively making this an enumerable parameter. Allowed values is an array of hashes of the following format: {label: ‘Import’, ‘value’: ‘import’}

  • namestr

    The name of the template.

  • categorystr

    The category of this template.

  • notestr

    A note describing what this template is used for; custom scripts created off this template will display this description.

  • created_at : str (time)

  • updated_at : str (time)

  • use_countint

    The number of uses of this template.

  • ui_report_idint

    The id of the report that this template uses.

  • tech_reviewedbool

    Whether this template has been audited by Civis for security vulnerability and correctness.

  • archivedbool

    Whether the template has been archived.

  • hiddenbool

    The hidden status of the item.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

put_reports(id: int, name: str, code_body: str, *, category: str = None, archived: bool = None, provide_api_key: bool = None)

Replace all attributes of this Report Template

Parameters:
idint
namestr

The name of the template.

code_bodystr

The code for the Template body.

categorystr, optional

The category of this report template. Can be left blank. Acceptable values are: dataset-viz

archivedbool, optional

Whether the template has been archived.

provide_api_keybool, optional

Whether reports based on this template request an API Key from the report viewer.

Returns:
civis.response.Response
  • id : int

  • namestr

    The name of the template.

  • categorystr

    The category of this report template. Can be left blank. Acceptable values are: dataset-viz

  • created_at : str (time)

  • updated_at : str (time)

  • use_countint

    The number of uses of this template.

  • archivedbool

    Whether the template has been archived.

  • tech_reviewedbool

    Whether this template has been audited by Civis for security vulnerability and correctness.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • auth_code_urlstr

    A URL to the template’s stored code body.

  • provide_api_keybool

    Whether reports based on this template request an API Key from the report viewer.

  • hiddenbool

    The hidden status of the item.

put_reports_shares_groups(id: int, group_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions groups has on this object

Parameters:
idint

The ID of the resource that is shared.

group_idsList[int]

An array of one or more group IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_reports_shares_users(id: int, user_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions users have on this object

Parameters:
idint

The ID of the resource that is shared.

user_idsList[int]

An array of one or more user IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_reports_transfer(id: int, user_id: int, include_dependencies: bool, *, email_body: str = None, send_email: bool = None)

Transfer ownership of this object to another user

Parameters:
idint

The ID of the resource that is shared.

user_idint

ID of target user

include_dependenciesbool

Whether or not to give manage permissions on all dependencies

email_bodystr, optional

Custom body text for e-mail sent on transfer.

send_emailbool, optional

Send email to the target user of the transfer?

Returns:
civis.response.Response
  • dependenciesList[dict]

    Dependent objects for this object

    • object_typestr

      Dependent object type

    • fco_typestr

      Human readable dependent object type

    • idint

      Dependent object ID

    • namestr

      Dependent object name, or nil if the requesting user cannot read this object

    • permission_levelstr

      Permission level of target user (not user’s groups) for dependent object. Null if no target user or not shareable (e.g. a database table).

    • descriptionstr

      Additional information about the dependency, if relevant

    • sharedbool

      Whether dependent object was successfully shared with target user

put_scripts(id: int, name: str, *, note: str = None, ui_report_id: int = None, archived: bool = None)

Replace all attributes of this Script Template

Parameters:
idint
namestr

The name of the template.

notestr, optional

A note describing what this template is used for; custom scripts created off this template will display this description.

ui_report_idint, optional

The id of the report that this template uses.

archivedbool, optional

Whether the template has been archived.

Returns:
civis.response.Response
  • id : int

  • publicbool

    If the template is public or not.

  • script_idint

    The id of the script that this template uses.

  • script_typestr

    The type of the template’s backing script (e.g SQL, Container, Python, R, JavaScript)

  • user_contextstr

    The user context of the script that this template uses.

  • paramsList[dict]

    A definition of the parameters that this template’s backing script accepts in the arguments field.

    • namestr

      The variable’s name as used within your code.

    • labelstr

      The label to present to users when asking them for the value.

    • descriptionstr

      A short sentence or fragment describing this parameter to the end user.

    • typestr

      The type of parameter. Valid options: string, multi_line_string, integer, float, bool, file, table, database, credential_aws, credential_redshift, or credential_custom

    • requiredbool

      Whether this param is required.

    • valuestr

      The value you would like to set this param to. Setting this value makes this parameter a fixed param.

    • defaultstr

      If an argument for this parameter is not defined, it will use this default value. Use true, True, t, y, yes, or 1 for true bool’s or false, False, f, n, no, or 0 for false bool’s. Cannot be used for parameters that are required or a credential type.

    • allowed_valuesList[dict]

      The possible values this parameter can take, effectively making this an enumerable parameter. Allowed values is an array of hashes of the following format: {label: ‘Import’, ‘value’: ‘import’}

  • namestr

    The name of the template.

  • categorystr

    The category of this template.

  • notestr

    A note describing what this template is used for; custom scripts created off this template will display this description.

  • created_at : str (time)

  • updated_at : str (time)

  • use_countint

    The number of uses of this template.

  • ui_report_idint

    The id of the report that this template uses.

  • tech_reviewedbool

    Whether this template has been audited by Civis for security vulnerability and correctness.

  • archivedbool

    Whether the template has been archived.

  • hiddenbool

    The hidden status of the item.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

put_scripts_projects(id: int, project_id: int)

Add a Script Template to a project

Parameters:
idint

The ID of the Script Template.

project_idint

The ID of the project.

Returns:
None

Response code 204: success

put_scripts_shares_groups(id: int, group_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions groups has on this object

Parameters:
idint

The ID of the resource that is shared.

group_idsList[int]

An array of one or more group IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_scripts_shares_users(id: int, user_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions users have on this object

Parameters:
idint

The ID of the resource that is shared.

user_idsList[int]

An array of one or more user IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_scripts_transfer(id: int, user_id: int, include_dependencies: bool, *, email_body: str = None, send_email: bool = None)

Transfer ownership of this object to another user

Parameters:
idint

The ID of the resource that is shared.

user_idint

ID of target user

include_dependenciesbool

Whether or not to give manage permissions on all dependencies

email_bodystr, optional

Custom body text for e-mail sent on transfer.

send_emailbool, optional

Send email to the target user of the transfer?

Returns:
civis.response.Response
  • dependenciesList[dict]

    Dependent objects for this object

    • object_typestr

      Dependent object type

    • fco_typestr

      Human readable dependent object type

    • idint

      Dependent object ID

    • namestr

      Dependent object name, or nil if the requesting user cannot read this object

    • permission_levelstr

      Permission level of target user (not user’s groups) for dependent object. Null if no target user or not shareable (e.g. a database table).

    • descriptionstr

      Additional information about the dependency, if relevant

    • sharedbool

      Whether dependent object was successfully shared with target user