IBM App ID API Calls: How to add attributes to customise a user with REST API?

300 views Asked by At

I have created a NodeJS application on IBM Cloud and connected it with the App ID Service. In that Service, I have added a user and setup the redirect URI. I can successfully log in with the user account by using Cloud Directory as the Identity Provider and I can see the /userinfo as well as the ID and Access Token (Bearer). I would like to change and add attributes of that user, but my PUT or POST requests do not work. However, my GET request is working:

curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer token' 'https://appid-oauth.eu-gb.bluemix.net/oauth/v3/91c8d285-580a-47ae-8928-e47e17127a35/userinfo'

I have tried following PUT and POST requests:

curl -X POST --header 'Content-Type: text/plain' --header 'Accept: application/json' --header 'Authorization: Bearer token' -d 'value' 'https://appid-profiles.ng.bluemix.net/userinfo'

and this:

curl -X POST --header 'Content-Type: text/plain' --header 'Accept: application/json' --header 'Authorization: Bearer token' -d 'attributeValue' 'https://appid-profiles.ng.bluemix.net/api/v1/attributes/attributeName'

This is the response:

Error 404: SRVE0295E: Error reported: 404

Using Postman, the response is:

Cannot POST or PUT /oauth/v3/91c8d285-58.../api/v1/attributes

How do I add attributes to a user using REST API?

1

There are 1 answers

1
Nitzan Nissim On

See the API at: https://appid-profiles.ng.bluemix.net/swagger-ui/index.html#!/Attributes/setAttribute

You cannot use POST to set an attribute, you should use PUT