How to delete attributes at /api/v1/meta/schemas/user/{schemaId} via api

I noticed the admin site runs a put to the corresponding admin endpoint at https://dev-12345678-admin.okta.com/api/v1/user/schemas/{schemaId} but cant replicate this behavior to the base endpoint. Any ideas?

Hi @sutru,

The schemas API is designed to be used by admins, so you’ll need to use an Admin account to access it. I’d also recommend following something like this instead: Schemas as it’s possible that endpoint isn’t designed to be used publicly.

Sorry reading back my initial question it doesnt seem I was really quite clear. What I am attempting to accomplish is deleting attributes from a profile schema using the schema API.
Lets assume I am adding the twitterUserName attribute to the default okta user schema I would make a request similar to the following

fetch(
  `https://${yourOktaDomain}/api/v1/meta/schemas/user/default`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Authorization: 'YOUR_API_KEY_HERE'
    },
    body: JSON.stringify({
      definitions: {
        custom: {
          id: '#custom',
          type: 'object',
          properties: {
            twitterUserName: {
              title: 'Twitter username',
              description: 'Twitter Username',
              type: 'string',
              required: false,
              minLength: 1,
              maxLength: 20,
              permissions: [
                {
                  principal: 'SELF',
                  action: 'READ_WRITE'
                }
              ]
            }
          },
          required: []
        }
      }
    })
  }
);

Now lets say some time in the future this attribute is no longer required is it possible to remove it using the API in the same way it was created. I attempted making a call as follows.

fetch(
  `https://${yourOktaDomain}/api/v1/meta/schemas/user/default`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Authorization: 'YOUR_API_KEY_HERE'
    },
    body:  JSON.stringify({
      definitions: {
        custom: {
          id: '#custom',
          type: 'object',
          properties: {},
          required: []
        }
      }
    })
  }
)

However this doesnt do anything. It doesnt appear any of the endpoints at Schemas can be used to accomplish this. Hopefully this helps.
Thanks again @daniel.sanders !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.