<jupyter_start><jupyter_text>Which _apps_ are in my project? OverviewYou can lists all apps available to you on the Platform. By default, all of the apps within your project(s) are returned to you. You can also choose to only list the apps within a specific project. Conversely, you can set the parameter `visibility=public` to list all apps available to you from the Seven Bridges' [Public Apps repository](http://docs.sevenbridges.com/v1.0/docs/public-apps) of tools and workflows. More generally, as with any **list**-type call, we will get minimal information about each app. There are two versions of this call: 1. (default) A **paginated** call that will return 50 apps. 2. An **all-records** call that will page through and return all apps. ObjectiveHere we focus on **listing all apps within one project**. [[reference](http://docs.sevenbridges.com/docs/list-all-apps-available-to-you)] Procedure1. We'll list all our projects.2. Then, we'll list the apps within the first project on the list generated above.3. Lastly, we'll list all apps within any of our projects by not specifying a project ID in our request. Prerequisites 1. You need to be a member (or owner) of at least one project. Learn more about creating a new project. [[recipe](projects_makeNew.ipynb)] [[reference](http://docs.sevenbridges.com/docs/create-a-new-project)]. 2. You need your **authentication token** and the API needs to know about it. See Setup_API_environment.ipynb for details. Learn more about [obtaining your authentication token](http://docs.sevenbridges.com/v1.0/docs/get-your-authentication-token). 3. You understand how to list projects of which you are a member. We will use this call directly to select a project below. [[recipe](projects_listAll.ipynb)] [[reference](http://docs.sevenbridges.com/docs/list-all-your-projects)] 4. You have at least one app in your selected project. If not, you can copy one from the Public Apps repository. [[recipe](apps_copyFromPublicApps.ipynb)] [[reference](http://docs.sevenbridges.com/docs/copy-an-app)]Note that as with all okAPI recipes, this recipe makes use of the [Seven Bridges Public API Python library](../Tutorials/SBPLAT/Setup_API_environment.ipynb).   ImportsWe import the `Api` class from the official `sevenbridges-python` bindings below.<jupyter_code>import sevenbridges as sbg<jupyter_output><empty_output><jupyter_text>Initialize the objectThe `Api` object needs to know your **auth\_token** and the correct path. Here we assume you are using the credentials file in your home directory. For other options see Setup_API_environment.ipynb<jupyter_code># [USER INPUT] specify credentials file profile {cgc, sbg, default}
prof = 'default'

config_file = sbg.Config(profile=prof)
api = sbg.Api(config=config_file)<jupyter_output><empty_output><jupyter_text>List all apps within a projectHere we can return the apps in a specific project or all the apps in projects of which you are a member. A **list**-call for apps returns the following useful *attributes*:* **`id`,** the *unique* identifier for each app, including the latest version number* **`name`,** the name of the app, which maybe _non-unique_* **`project`,** the project the app is in.* **`href`,** the address1 of the app.1 This is the address where, by using API, you can get this resource By passing a `project_id` into the `api.apps.query()` below, we will get the apps **inside that project**.<jupyter_code># [USER INPUT] Set project name:
# Note that you can have multiple apps or projects with the same name. It is best practice to reference entities by ID.
project_name = 'test shellquote'


# LIST all projects and check for name match
my_project = api.projects.query(limit=100, name=project_name)

if not my_project:    # exploit fact that empty list is False, {list, tuple, etc} is True
    print('The project named (%s) does not exist, please check spelling (especially trailing spaces)' \
          % project_name)
    raise KeyboardInterrupt
else:
    my_project = my_project[0]
    
    # list the apps in my project    
    my_apps = api.apps.query(project=my_project.id, limit=100)
    print('   In project {}, you have {} apps.'.format(
        my_project.name, my_apps.total))

    for a in my_apps.all(): 
        print('App name: {}; \t App id: {}\n'.format(
            a.name, a.id))<jupyter_output><empty_output><jupyter_text>By **not** passing a `project_id` into the `api.apps.query()` below, we will get all the apps for **any project** of which you are a member.<jupyter_code># list the app in ALL your projects.
my_apps_all_projects = api.apps.query(limit=100)

print('   In ALL your projects, you have {} apps.'.format(
    my_apps_all_projects.total))

for a in my_apps_all_projects.all(): 
    print('App name: {}; \t App id: {}\n'.format(
        a.name, a.id))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10113753877973113, 'fraction_numerical': 0.005584281282316443, 'mean_word_length': 4.552238805970149, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '208281', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1376, 'n_words': 594, 'path': 'Recipes/SBPLAT/apps_listAll.ipynb', 'repo_name': 'sbg/okAPI', 'size': '4835'}