# AWX cli project modify - Bad Request

**URL:** <https://forum.ansible.com/t/awx-cli-project-modify-bad-request/1934>\
**Category:** Get Help\
**Tags:** awx\
**Created:** [October 24, 2023, 11:18pm UTC](https://forum.ansible.com/t/awx-cli-project-modify-bad-request/1934 "2023-10-24T23:18:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lbrigman124](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@lbrigman124](https://forum.ansible.com/u/lbrigman124)\
**Post date:** [October 24, 2023, 11:18pm UTC](https://forum.ansible.com/t/awx-cli-project-modify-bad-request/1934/1 "2023-10-24T23:18:28Z")

</div>

Using AWX 23.1.0 trying to configure awx with the awxkit of the same version.  
I try the following

```auto
awx -f human -v project modify --organization=mdc --credential=mdc --scm_type=git --scm_url=http://git.gsm.svc.cluster.local.:8080/mdc-nodeplays.git --scm_branch=23.10.11 --scm_update_on_launch=false mdc_23.10.11

```

and get  
BadRequest credential must be scm

Trace output:

```auto
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): awx-service.gsm.svc.cluster.local:80
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/ HTTP/1.1" 200 186
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/" elapsed: 0:00:00.071116
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.api.ApiV2'> by url: /api/v2/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/v2/ HTTP/1.1" 200 1931
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/v2/" elapsed: 0:00:00.069139
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.projects.Projects'> by url: /api/v2/projects/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "OPTIONS /api/v2/projects/ HTTP/1.1" 200 19395
DEBUG:awxkit.api.client:"OPTIONS http://awx-service.gsm.svc.cluster.local:80/api/v2/projects/" elapsed: 0:00:00.120725
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.projects.Projects'> by url: /api/v2/projects/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "OPTIONS /api/v2/projects/1/ HTTP/1.1" 200 10419
DEBUG:awxkit.api.client:"OPTIONS http://awx-service.gsm.svc.cluster.local:80/api/v2/projects/1/" elapsed: 0:00:00.136305
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "OPTIONS /api/v2/projects/1/update/ HTTP/1.1" 200 697
DEBUG:awxkit.api.client:"OPTIONS http://awx-service.gsm.svc.cluster.local:80/api/v2/projects/1/update/" elapsed: 0:00:00.091384
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.projects.Projects'> by url: /api/v2/projects/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/v2/projects/?name=mdc_23.10.11 HTTP/1.1" 200 2805
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/v2/projects/?name=mdc_23.10.11" elapsed: 0:00:00.156888
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.projects.Project'> by url: /api/v2/projects/8/
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.organizations.Organizations'> by url: /api/v2/organizations/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/v2/organizations/?name=mdc HTTP/1.1" 200 3495
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/v2/organizations/?name=mdc" elapsed: 0:00:00.162672
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.organizations.Organization'> by url: /api/v2/organizations/2/
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.credentials.Credentials'> by url: /api/v2/credentials/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/v2/credentials/?name=mdc HTTP/1.1" 200 1632
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/v2/credentials/?name=mdc" elapsed: 0:00:00.141936
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.credentials.Credential'> by url: /api/v2/credentials/3/
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.projects.Projects'> by url: /api/v2/projects/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/v2/projects/?name=mdc_23.10.11 HTTP/1.1" 200 2805
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/v2/projects/?name=mdc_23.10.11" elapsed: 0:00:00.161478
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.projects.Project'> by url: /api/v2/projects/8/
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.projects.Project'> by url: /api/v2/projects/8/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "PATCH /api/v2/projects/8/ HTTP/1.1" 400 49
DEBUG:awxkit.api.client:"PATCH http://awx-service.gsm.svc.cluster.local:80/api/v2/projects/8/" elapsed: 0:00:00.132049
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/awxkit/cli/ __init__.py", line 25, in run
    cli.parse_resource()
  File "/usr/local/lib/python3.11/site-packages/awxkit/cli/client.py", line 166, in parse_resource
    response = self.parse_action(resource)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/awxkit/cli/client.py", line 278, in parse_action
    return getattr(page, self.method)(**parsed)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/awxkit/api/pages/page.py", line 464, in patch
    return self._create().patch(**payload)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/awxkit/api/pages/page.py", line 277, in patch
    return self.page_identity(r, request_json=json)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/awxkit/api/pages/page.py", line 234, in page_identity
    raise exc.BadRequest(exc_str, data)
awxkit.exceptions.BadRequest: Bad Request (400) received - {'credential': ["Credential kind must be 'scm'."]}
 <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
BadRequest

```

The output doesn’t match the documentation

---

<div class="post-metadata">

**Author:** ![lbrigman124](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@lbrigman124](https://forum.ansible.com/u/lbrigman124)\
**Post date:** [October 25, 2023, 6:21pm UTC](https://forum.ansible.com/t/awx-cli-project-modify-bad-request/1934/2 "2023-10-25T18:21:00Z")

</div>

Looks like the create function also is getting the same error.

```auto
 awx -v -f human project create --name=mdc_23.10.11 --credential=mdc --organization=mdc --scm_type=git --scm_url=http://git.gsm.svc.cluster.local.:8080/mdc-nodeplays.git --scm_branch=23.10.11 --scm_update_onlaunch=false --wait
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): awx-service.gsm.svc.cluster.local:80
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/ HTTP/1.1" 200 186
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/" elapsed: 0:00:00.076966
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.api.ApiV2'> by url: /api/v2/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/v2/ HTTP/1.1" 200 1931
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/v2/" elapsed: 0:00:00.077850
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/ HTTP/1.1" 200 186
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/" elapsed: 0:00:00.078098
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "POST /api/login/ HTTP/1.1" 302 0
DEBUG:awxkit.api.client:"POST http://awx-service.gsm.svc.cluster.local:80/api/login/" elapsed: 0:00:00.592765
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/ HTTP/1.1" 200 186
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/" elapsed: 0:00:00.084446
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/ HTTP/1.1" 200 186
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/" elapsed: 0:00:00.083442
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.projects.Projects'> by url: /api/v2/projects/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "OPTIONS /api/v2/projects/ HTTP/1.1" 200 19395
DEBUG:awxkit.api.client:"OPTIONS http://awx-service.gsm.svc.cluster.local:80/api/v2/projects/" elapsed: 0:00:00.109804
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.projects.Projects'> by url: /api/v2/projects/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "OPTIONS /api/v2/projects/1/ HTTP/1.1" 200 10419
DEBUG:awxkit.api.client:"OPTIONS http://awx-service.gsm.svc.cluster.local:80/api/v2/projects/1/" elapsed: 0:00:00.128319
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "OPTIONS /api/v2/projects/1/update/ HTTP/1.1" 200 697
DEBUG:awxkit.api.client:"OPTIONS http://awx-service.gsm.svc.cluster.local:80/api/v2/projects/1/update/" elapsed: 0:00:00.085747
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.credentials.Credentials'> by url: /api/v2/credentials/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/v2/credentials/?name=mdc HTTP/1.1" 200 1632
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/v2/credentials/?name=mdc" elapsed: 0:00:00.146375
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.credentials.Credential'> by url: /api/v2/credentials/3/
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.organizations.Organizations'> by url: /api/v2/organizations/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "GET /api/v2/organizations/?name=mdc HTTP/1.1" 200 3495
DEBUG:awxkit.api.client:"GET http://awx-service.gsm.svc.cluster.local:80/api/v2/organizations/?name=mdc" elapsed: 0:00:00.154721
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.organizations.Organization'> by url: /api/v2/organizations/2/
awx: unrecognized arguments: --scm_update_onlaunch=false
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.projects.Projects'> by url: /api/v2/projects/
DEBUG:urllib3.connectionpool:http://awx-service.gsm.svc.cluster.local:80 "POST /api/v2/projects/ HTTP/1.1" 400 49
DEBUG:awxkit.api.client:"POST http://awx-service.gsm.svc.cluster.local:80/api/v2/projects/" elapsed: 0:00:00.119428
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/awxkit/cli/ __init__.py", line 25, in run
    cli.parse_resource()
  File "/usr/local/lib/python3.11/site-packages/awxkit/cli/client.py", line 166, in parse_resource
    response = self.parse_action(resource)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/awxkit/cli/client.py", line 276, in parse_action
    return page.post(parsed)
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/awxkit/cli/custom.py", line 162, in post
    response = self.page.post(kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/awxkit/api/pages/page.py", line 458, in post
    return self._create().post(payload)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/awxkit/api/pages/page.py", line 281, in post
    return self.page_identity(r, request_json=json)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/awxkit/api/pages/page.py", line 234, in page_identity
    raise exc.BadRequest(exc_str, data)
awxkit.exceptions.BadRequest: Bad Request (400) received - {'credential': ["Credential kind must be 'scm'."]}
 <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
BadRequest

```

Not sure why in older versions of AWX, the job template had the credential option  
Now that has been moved to the project.

---

<div class="post-metadata">

**Author:** ![lbrigman124](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@lbrigman124](https://forum.ansible.com/u/lbrigman124)\
**Post date:** [October 25, 2023, 8:11pm UTC](https://forum.ansible.com/t/awx-cli-project-modify-bad-request/1934/3 "2023-10-25T20:11:52Z")

</div>

After reading through the docs and the source some more, the credential for the project is related directly to being able to access the SCM.

So how do you define a credential for a job\_template since that option is now gone?

---

<div class="post-metadata">

**Author:** ![lbrigman124](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@lbrigman124](https://forum.ansible.com/u/lbrigman124)\
**Post date:** [October 25, 2023, 8:21pm UTC](https://forum.ansible.com/t/awx-cli-project-modify-bad-request/1934/4 "2023-10-25T20:21:14Z")

</div>

Digging through the UI found the option to add credentials to a job template.  
The API doesn’t provide that.  
Turns out that it needs a second call to the API to associate a credential to the job template.

I guess some better examples or some usage are needed. Just the API descriptions seem to be less than sufficient.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 24, 2023, 8:21pm UTC](https://forum.ansible.com/t/awx-cli-project-modify-bad-request/1934/5 "2023-11-24T20:21:14Z")

</div>

Closed on November 24, 2023, 8:21pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
