By: Hamdi Bahrini user 21 Aug 2020 at 1:01 a.m. CDT

1 Response
Hamdi Bahrini gravatar
Hello community, i'm trying to get the oxExternalUid so i added this attribute to the extension. The "returned" value is default for this attribute so i have to specify it in the request attribute parameters like it mentioned in the [RFC7643](https://tools.ietf.org/html/rfc7643#section-7) (*If the GET request "attributes" parameter is specified, attribute values are only returned if the attribute is named in the "attributes" parameter*) **The extension:** ``` { "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:Schema" ], "id": "urn:ietf:params:scim:schemas:extension:gluu:2.0:User", "meta": { "resourceType": "Schema", "location": "https://.../identity/restv1/scim/v2/Schemas/urn:ietf:params:scim:schemas:extension:gluu:2.0:User" }, "name": "GluuUserCustomExtension", "description": "Gluu User Custom Extension", "attributes": [ { "name": "oxEnrollmentCode", "type": "string", "multiValued": false, "description": "oxEnrollmentCode", "required": false, "caseExact": false, "mutability": "readWrite", "returned": "default", "uniqueness": "none" }, { "name": "oxExternalUid", "type": "string", "multiValued": false, "description": "user secret key", "required": false, "caseExact": false, "mutability": "readWrite", "returned": "default", "uniqueness": "none" } ] } ``` **The request without attributes:** ``` curl -G -H 'Authorization: Bearer 5d365c28............6' \ --data-urlencode 'filter=userName eq "test"' https://...../identity/restv1/scim/v2/Users ``` **The response:** ``` { "Resources": [ { "active": true, "displayName": "foo bar", "emails": [ { "primary": false, "value": "test@test.com" } ], "id": "@!6DD5.2317.2C71.B3BD!0001!3F53.7A78!0000!61AF.AD9A.51A6.5AA8", "meta": { "created": "2019-07-05T20:52:26.000Z", "lastModified": "2020-08-21T00:02:46.615Z", "location": "https://../identity/restv1/scim/v2/Users/@!6DD5.2317.2C71.B3BD!0001!3F53.7A78!0000!61AF.AD9A.51A6.5AA8", "resourceType": "User" }, "name": { "familyName": "bar", "formatted": "foo bar", "givenName": "foo" }, "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User" ], "userName": "test" } ], "itemsPerPage": 1, "schemas": [ "urn:ietf:params:scim:api:messages:2.0:ListResponse" ], "startIndex": 1, "totalResults": 1 } ``` **The request with the attributes:** ``` curl -G -H 'Authorization: Bearer 3cf7............3' \ --data-urlencode 'filter=userName eq "test"' https://...../identity/restv1/scim/v2/Users?attributes=oxExternalUid ``` **The response:** ``` { "Resources": [ { "id": "@!6DD5.2317.2C71.B3BD!0001!3F53.7A78!0000!61AF.AD9A.51A6.5AA8", "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User" ] } ], "itemsPerPage": 1, "schemas": [ "urn:ietf:params:scim:api:messages:2.0:ListResponse" ], "startIndex": 1, "totalResults": 1 } ``` I think there is a problem with the parameters because when i change it with "userName" for example it works **The request:** ``` curl -G -H 'Authorization: Bearer fe5569ef..............' \ --data-urlencode 'filter=userName eq "test"' https://.../identity/restv1/scim/v2/Users?attributes=userName ``` **The response:** ``` { "Resources": [ { "id": "@!6DD5.2317.2C71.B3BD!0001!3F53.7A78!0000!61AF.AD9A.51A6.5AA8", "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User" ], "userName": "test" } ], "itemsPerPage": 1, "schemas": [ "urn:ietf:params:scim:api:messages:2.0:ListResponse" ], "startIndex": 1, "totalResults": 1 } ```

By Jose Gonzalez staff 21 Aug 2020 at 7:25 a.m. CDT

Jose Gonzalez gravatar
Attributes part of extensions cannot be referred simply by name, they have to be prefixed accordingly, eg. `urn:ietf:params:scim:schemas:extension:gluu:2.0:User:oxExternalUid`. Adjust your `attributes` param to conform. Core attributes do not need a prefix, as in the case of `userName`