List Projects for an Organization
/api/v2/organizations/{id}/projects/
Make a GET request to this resource to retrieve a list of projects associated with the selected organization.
The resulting data structure contains:
{
"count": 99,
"next": null,
"previous": null,
"results": [
...
]
}
The count
field indicates the total number of projects
found for the given query. The next
and previous
fields provides links to
additional results if there are more than will fit on a single page. The
results
list contains zero or more project records.
Results
Each project data structure includes the following fields:
id
: Database ID for this project. (integer)type
: Data type for this project. (choice)url
: URL for this project. (string)related
: Data structure with URLs of related resources. (object)summary_fields
: Data structure with name/description for related resources. The output for some objects may be limited for performance reasons. (object)created
: Timestamp when this project was created. (datetime)modified
: Timestamp when this project was last modified. (datetime)name
: Name of this project. (string)description
: Optional description of this project. (string)local_path
: Local path (relative to PROJECTS_ROOT) containing playbooks and related files for this project. (string)scm_type
: Specifies the source control system used to store the project. (choice)""
: Manualgit
: Gitsvn
: Subversioninsights
: Red Hat Insightsarchive
: Remote Archive
scm_url
: The location where the project is stored. (string)scm_branch
: Specific branch, tag or commit to checkout. (string)scm_refspec
: For git projects, an additional refspec to fetch. (string)scm_clean
: Discard any local changes before syncing the project. (boolean)scm_track_submodules
: Track submodules latest commits on defined branch. (boolean)scm_delete_on_update
: Delete the project before syncing. (boolean)credential
: (id)timeout
: The amount of time (in seconds) to run before the task is canceled. (integer)scm_revision
: The last revision fetched by a project update (string)last_job_run
: (datetime)last_job_failed
: (boolean)next_job_run
: (datetime)status
: (choice)new
: Newpending
: Pendingwaiting
: Waitingrunning
: Runningsuccessful
: Successfulfailed
: Failederror
: Errorcanceled
: Cancelednever updated
: Never Updatedok
: OKmissing
: Missing
organization
: The organization used to determine access to this template. (id)scm_update_on_launch
: Update the project when a job is launched that uses the project. (boolean)scm_update_cache_timeout
: The number of seconds after the last project update ran that a new project update will be launched as a job dependency. (integer)allow_override
: Allow changing the SCM branch or revision in a job template that uses this project. (boolean)custom_virtualenv
: Local absolute file path containing a custom Python virtualenv to use (string)default_environment
: The default execution environment for jobs run using this project. (id)last_update_failed
: (boolean)last_updated
: (datetime)
Sorting
To specify that projects are returned in a particular
order, use the order_by
query string parameter on the GET request.
?order_by=name
Prefix the field name with a dash -
to sort in reverse:
?order_by=-name
Multiple sorting fields may be specified by separating the field names with a
comma ,
:
?order_by=name,some_other_field
Pagination
Use the page_size
query string parameter to change the number of results
returned for each request. Use the page
query string parameter to retrieve
a particular page of results.
?page_size=100&page=2
The previous
and next
links returned with the results will set these query
string parameters automatically.
Searching
Use the search
query string parameter to perform a case-insensitive search
within all designated text fields of a model.
?search=findme
(Added in Oracle Linux Automation Manaer) Search across related fields:
?related__search=findme
Request
- application/json
-
page: integer
A page number within the paginated result set.
-
page_size: integer
Number of results to return per page.
-
search: string
A search term.
Response
- application/json
200 Response
{
"count":"1",
"next":null,
"previous":null,
"results":[
{
"allow_override":false,
"created":"2018-02-01T08:00:00.000000Z",
"credential":null,
"custom_virtualenv":null,
"default_environment":null,
"description":"description for project-one",
"id":"1",
"last_job_failed":false,
"last_job_run":null,
"last_update_failed":false,
"last_updated":null,
"local_path":"",
"modified":"2018-02-01T08:00:00.000000Z",
"name":"project-one",
"next_job_run":null,
"organization":"1",
"related":{
"access_list":"/api/v2/projects/1/access_list/",
"activity_stream":"/api/v2/projects/1/activity_stream/",
"copy":"/api/v2/projects/1/copy/",
"inventory_files":"/api/v2/projects/1/inventories/",
"notification_templates_error":"/api/v2/projects/1/notification_templates_error/",
"notification_templates_started":"/api/v2/projects/1/notification_templates_started/",
"notification_templates_success":"/api/v2/projects/1/notification_templates_success/",
"object_roles":"/api/v2/projects/1/object_roles/",
"organization":"/api/v2/organizations/1/",
"playbooks":"/api/v2/projects/1/playbooks/",
"project_updates":"/api/v2/projects/1/project_updates/",
"schedules":"/api/v2/projects/1/schedules/",
"scm_inventory_sources":"/api/v2/projects/1/scm_inventory_sources/",
"teams":"/api/v2/projects/1/teams/",
"update":"/api/v2/projects/1/update/"
},
"scm_branch":"",
"scm_clean":false,
"scm_delete_on_update":false,
"scm_refspec":"",
"scm_revision":"",
"scm_track_submodules":false,
"scm_type":"",
"scm_update_cache_timeout":"0",
"scm_update_on_launch":false,
"scm_url":"",
"status":"missing",
"summary_fields":{
"object_roles":{
"admin_role":{
"description":"Can manage all aspects of the project",
"id":"16",
"name":"Admin"
},
"read_role":{
"description":"May view settings for the project",
"id":"19",
"name":"Read"
},
"update_role":{
"description":"May update the project",
"id":"18",
"name":"Update"
},
"use_role":{
"description":"Can use the project in a job template",
"id":"17",
"name":"Use"
}
},
"organization":{
"description":"test-org-desc",
"id":"1",
"name":"test-org"
},
"user_capabilities":{
"copy":false,
"delete":false,
"edit":false,
"schedule":false,
"start":false
}
},
"timeout":"0",
"type":"project",
"url":"/api/v2/projects/1/"
}
]
}
403 Response
{
"detail":"You do not have permission to perform this action."
}