How do I create Protocol Mappers with the following values (as seen in
the attached image) via Keycloak's REST API?
You can do it by calling the following endpoint:
POST ${KEYCLOAK_HOST}/auth/admin/realms/${REALM_NAME}/clients/${ID of the Client}/protocol-mappers/models
with the following data:
{"protocol":"openid-connect","config":{"id.token.claim":"true","access.token.claim":"true","userinfo.token.claim":"true","multivalued":"","aggregate.attrs":"","user.attribute":"some-attribute","claim.name":"some-attribute","jsonType.label":"String"},"name":"some-attribute","protocolMapper":"oidc-usermodel-attribute-mapper"}
I did find this: Protocol Mapper - but the
ProtocolMapperRepresentation takes in a Map and a couple of Strings.
When I see the UI - I see a lot more fields and I'm not sure if I'm
looking at the right API.
That is by design; to make the endpoint abstract enough to accept different types of Protocol Mappers. That Map encodes basically the config part which tend to change from mapper to mapper.