WSO2 IS Request is unparsable, syntactically incorrect, or violates schema

Viewed 72

I'm trying to integrate my service with WSO2 identity server. I found scim2 API, that aplly creates users by rest requset. The sample request is:

{
    "schemas": [],
    "name": {
        "familyName": "resttest@gmail.com",
        "givenName": "RestTest"
    },
    "userName": "resttest@gmail.com",
    "password": "admin",
    "emails": [{
            "primary": true,
            "value": "resttest@gmail.com",
            "type": "home"
        }
    ]
}

but I get response:

{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:Error"
    ],
    "scimType": "invalidSyntax",
    "detail": "Request is unparsable, syntactically incorrect, or violates schema.",
    "status": "400"
}

What I'm doing wrong? I can't find helpful information in the logs. The only one line from the logs below:

ERROR {org.wso2.charon3.core.encoder.JSONDecoder} - json error in decoding the resource
1 Answers

NOTE: My answer is based on thinking that you have initiated a curl.

Seems Like there is an issue with the encoding. I have tried this with the IS 6.0.0 with the following curl (exported it from the postman) and it worked.

curl -L -X POST 'https://localhost:9443/scim2/Users' -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW46YWRtaW4=' --data-raw '{
"schemas": [],
"name": {
    "familyName": "resttest@gmail.com",
    "givenName": "RestTest"
},
"userName": "resttest@gmail.com",
"password": "admin",
"emails": [{
        "primary": true,
        "value": "resttest@gmail.com",
        "type": "home"
    }
]}'

Here note that I have used admin credentials to create the user request. You can change the request auth as you need.

To validate your Curl you can import your curl request from the PostMan and check whether you receive the correct payload as expected in your question.

Related