Create a Project

post

/api/v2/projects/

Make a POST request to this resource with the following project fields to create a new project:

  • name: Name of this project. (string, required)
  • description: Optional description of this project. (string, default="")
  • local_path: Local path (relative to PROJECTS_ROOT) containing playbooks and related files for this project. (string, default="")
  • scm_type: Specifies the source control system used to store the project. (choice)
    • "": Manual (default)
    • git: Git
    • svn: Subversion
    • insights: Red Hat Insights
    • archive: Remote Archive
  • scm_url: The location where the project is stored. (string, default="")
  • scm_branch: Specific branch, tag or commit to checkout. (string, default="")
  • scm_refspec: For git projects, an additional refspec to fetch. (string, default="")
  • scm_clean: Discard any local changes before syncing the project. (boolean, default=False)
  • scm_track_submodules: Track submodules latest commits on defined branch. (boolean, default=False)
  • scm_delete_on_update: Delete the project before syncing. (boolean, default=False)
  • credential: (id, default=``)
  • timeout: The amount of time (in seconds) to run before the task is canceled. (integer, default=0)

  • organization: The organization used to determine access to this template. (id, default=``)

  • scm_update_on_launch: Update the project when a job is launched that uses the project. (boolean, default=False)
  • 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, default=0)
  • allow_override: Allow changing the SCM branch or revision in a job template that uses this project. (boolean, default=False)

  • default_environment: The default execution environment for jobs run using this project. (id, default=``)

Request

Supported Media Types
Body ()
Root Schema : schema
Example:
{
    "allow_override":true,
    "name":"fooo",
    "organization":"1",
    "scm_type":"git",
    "scm_url":"https://github.com/ansible/test-playbooks.git"
}
Back to Top

Response

Supported Media Types

201 Response

Body
Example Response (application/json)
{
    "allow_override":true,
    "created":"2018-02-01T08:00:00.000000Z",
    "credential":null,
    "custom_virtualenv":null,
    "default_environment":null,
    "description":"",
    "id":"1",
    "last_job_failed":false,
    "last_job_run":null,
    "last_update_failed":false,
    "last_updated":null,
    "local_path":"_1__fooo",
    "modified":"2018-02-01T08:00:00.000000Z",
    "name":"fooo",
    "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/",
        "current_job":"/api/v2/project_updates/1/",
        "current_update":"/api/v2/project_updates/1/",
        "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":"git",
    "scm_update_cache_timeout":"0",
    "scm_update_on_launch":false,
    "scm_url":"https://github.com/ansible/test-playbooks.git",
    "status":"pending",
    "summary_fields":{
        "current_job":{
            "description":"",
            "failed":false,
            "id":"1",
            "name":"fooo",
            "status":"pending"
        },
        "current_update":{
            "description":"",
            "failed":false,
            "id":"1",
            "name":"fooo",
            "status":"pending"
        },
        "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":true,
            "delete":true,
            "edit":true,
            "schedule":true,
            "start":true
        }
    },
    "timeout":"0",
    "type":"project",
    "url":"/api/v2/projects/1/"
}

415 Response

Body
Example Response (application/json)
{
    "detail":"Unsupported media type \"text/html\" in request."
}
Back to Top