POST /api/v2/clients doesn't allow create a new client - Bad request

Hi,
I need your help please, i’m trying to create a new client using the endpoint POST /api/v2/clients but always i get:

{
“statusCode”: 400,
“error”: “Bad Request”,
“message”: “Payload validation error: ‘Expected type object but found type null’.”,
“errorCode”: “invalid_body”
}

I know that Bad Request is my error but i don’t know where is the error, i don’t know what is missing, i tried with different json body but the result is the same.

This is the code in python to test:

import http.client
import json

headers = {‘Content-type’: ‘application/json’,
‘authorization’: “Bearer eyJ0eXAiOiJKV1…”}

client_post = {
“name”: “MyApplication1”,
“description”: “test”,
“logo_uri”: “https://my.logo.com/uri”,
“callbacks”: [
https://mydomain.auth0.com/callback
],
“allowed_origins”: [
https://mydomain.auth0.com
],
“client_aliases”: [
https://mydomain.auth0.com
],
“allowed_clients”: [
“clientId1”
],
“allowed_logout_urls”: [
https://mydomain.auth0.com/logout
],
“token_endpoint_auth_method”: “client_secret_post”,
“app_type”: “non_interactive”,
“oidc_conformant”: False,
“jwt_configuration”: {
“alg”: “RS256”,
“lifetime_in_seconds”: 1728000,
“secret_encoded”: False
},
“encryption_key”: {
“pub”: “”,
“cert”: “”,
“subject”: “”
},
“sso”: False,
“sso_disabled”: False,
“cross_origin_auth”: False,
“cross_origin_loc”: “”,
“custom_login_page_on”: False,
“custom_login_page”: “”,
“custom_login_page_preview”: “”,
“form_template”: “”,
“is_heroku_app”: False,
“addons”: {
“slack”: {
“team”: “MyTeam”
}
},
“client_metadata”: {},
“mobile”: {
“android”: {
“app_package_name”: “mydomain.com.example”,
“sha256_cert_fingerprints”: [
“D8:A0:83:…”
]
},
“ios”: {
“team_id”: “9JA89QQLNQ”,
“app_bundle_identifier”: “com.my.bundle.id”
}
}
}

json_data_post = json.dumps(client_post)
conn.request(“POST”, “/api/v2/clients”, headers=headers)

However i can to do GET /api/v2/clients good.

Could someone help me please?

Thanks,

Carlos Llano

It looks as if the payload (json_data_post) is missing in the request.

Instead of:

conn.request(“POST”, “/api/v2/clients”, headers=headers)

try:

conn.request(“POST”, “/api/v2/clients”, body=json_data_post, headers=headers)

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