MAAS API use application/x-www-form-urlencoded content type, not application/json

My environment is setup as follows:
Default MAAS-provided image: Ubuntu 22.04
Other image(s): RHEL 7 (uploaded via boot-resource command)

When trying to deploy a machine with RHEL 7 from the UI or through deploy command, machine is deployed successfully.

maas local boot-resources create name='rhel/7' title='RHEL 7' architecture='amd64/generic' filetype='tgz' content@=rhel7.tar.gz

However, on using the API endpoint
POST /MAAS/api/2.0/machines/{system_id}/op-deploy
with distro_series as rhel/7, Ubuntu 22.04 is deployed instead of RHEL 7.

Is this an issue with the API endpoint?

Hey,

I just tries and it works fine on my end.

The API accept form data, not json: I suspect you might be sending a request with a json payload and it is actually ignored.

You can try with

curl --header "Authorization: OAuth oauth_version=1.0, oauth_signature_method=PLAINTEXT, oauth_consumer_key=<YOUR KEY>, oauth_token=<YOUR TOKEN>, oauth_signature=&<YOUR SIGNATURE>, oauth_nonce=$(uuidgen), oauth_timestamp=$(date +%s)" <MAAS URL>/MAAS/api/2.0/machines/<YOUR SYSTEM ID>/op-deploy -d "distro_series=rhel/7"

Thanks a lot for the quick reply!
I’m not sure how I missed that in the API docs, it works now.

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