1

I'm using wso2 identity server version 5.0.0 with user store on mysql. When I try to insert user with phone numbers, the phone number are not stored.

curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim@aaaa.it" ,"phoneNumbers":[{"value":"8811","type":"work"},{"value":"3473344555","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users

the result is:

Connection #0 to host localhost left intact
{"id":"f6ce5310-a2ee-4976-9579-0299029183bb","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","phoneNumbers":[{"type":"work"},{"type":"mobile"}],"emails":"rossim@aaaa.it","meta":{"lastModified":"2015-08-19T16:09:50","location":"https://192.168.3.43:9443/wso2/scim/Users/f6ce5310-a2ee-4976-9579-0299029183bb","created":"2015-08-19T16:09:50"}}

if I put a char in the phone number, it works fine:

curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim@aaaa.it" ,"phoneNumbers":[{"value":"_8811","type":"work"},{"value":"_3473344555","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users

the result is:

Connection #0 to host localhost left intact
{"id":"3ce83aca-6f70-4274-a2c3-5429132d6001","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","phoneNumbers":[{"value":"_8811","type":"work"},{"value":"_3473344555","type":"mobile"}],"emails":"rossim@aaaa.it","meta":{"lastModified":"2015-08-19T16:12:50","location":"https://192.168.3.43:9443/wso2/scim/Users/3ce83aca-6f70-4274-a2c3-5429132d6001","created":"2015-08-19T16:12:50"}}

Why? a phone number... is a number!

4

2 回答 2

2

Phone number can be stored when enter the number within back slashes. Example : \"3473344555\"

Please find the modified curl command which works fine. curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim@aaaa.it" ,"phoneNumbers":[{"value":\"8811\","type":"work"},{"value":\"3473344555\","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users

Result : {"id":"a5520dfc-aa7c-4b4b-aba2-57df7b87e2e4","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName": "rossiusr","phoneNumbers":[{"value":"8811","type":"work"},{"value":"3473344555","type":"mobile"}],"emails":"rossim@aaaa.it","meta":{"lastModified" :"2016-01-19T11:04:32","location":"https://localhost:9443/wso2/scim/Users/a5520dfc-aa7c-4b4b-aba2-57df7b87e2e4","created":"2016-01-19T11:04:32"}}* Connection #0 to host localhost left intact

于 2016-01-19T05:58:12.147 回答
0

This is a CURL POST Request example To add Bulk users into the WSO2 Identity Server,

curl --location --request POST 'https://localhost:9443/scim2/Bulk' \
--header 'Content-Type: application/scim+json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data-raw '{
    emphasized text"failOnErrors":1,
    "schemas": ["urn:ietf:params:scim:api:messages:2.0:BulkRequest"],
    "Operations": [
        {
            "method": "POST",
            "path": "/Users",
            "bulkId": "bulkId01",
            "data": {
                "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
                "userName": "Test",
                "password":"Mohsen123",
                "name": {
                    "givenName": "Test01",
                    "familyName": "Tes01t"
                },
                 "emails": [
                    {
                        "type": "home",
                        "value": "home@test.com",
                        "primary": true
                    },
                    {
                        "type": "work",
                        "value": "work@test.com"
                    },
                    {
                        "type": "other",
                        "value": "other@test.com"
                    }
                ]
            }
        },
        {
            "method": "POST",
            "path": "/Users",
            "bulkId": "bulkId02",
            "data": {
                "schemas": [
                    "urn:ietf:params:scim:schemas:core:2.0:User",
                    "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
                    ],
                "name": {
                    "givenName": "Test02",
                    "familyName": "Test02"
                },
                "userName": "Test02",
                "password": "Mohsen123",
                "emails": [
                    {
                        "type": "home",
                        "value": "home@test.com",
                        "primary": true
                    },
                    {
                        "type": "work",
                        "value": "work@test.com"
                    },
                    {
                        "type": "other",
                        "value": "other@test.com"
                    }
                ],
                "phoneNumbers":[
                  {
                    "value":"8811",
                    "type":"work"
                  },
                  {
                    "value":"3473344555",
                    "type":"mobile"
                  }
                ],
                "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
                    "employeeNumber": "1234A",
                    "costCenter": "hello",
                    "country": "country",
                    "dob":"dateOfBirth",
                    "manager": {
                        "value": "Admin"
                    }
                }
            }
        }
    ]
}
于 2020-12-06T09:20:29.153 回答