How can I get user info (name, surname, company) from an owner ID?

Hi there,

I am retrieving client owner IDs from a Project through the API, and I would like to get their related user information (name, surname, company name) based on those IDs.
I have checked the UserSearch.vue component which seems to do it, and then noticed that I do not have access to /accounts/ (see below)


Any hints?


Hey Paul!

There’s actually an api endpoint for this; it though needs always an authorization token. If you’re working in speckle admin, there’s already a method to get that info in the store. It looks like this:

getUser( context, payload ) {
      return new Promise( ( resolve, reject ) => {
        let found = context.state.users.find( u => u._id === payload._id )
        if ( found ) return resolve( found )
        Axios.get( `accounts/${payload._id}` )
          .then( res => {
            if ( context.state.user._id === payload._id ) += ' (that is you!)'
            context.commit( 'ADD_USER', )
            return resolve( )
          } )
          .catch( err => {
            return reject( err )
          } )
      } )

Hope this helps & thanks for asking on the forum, so others can pick up later!

1 Like

Thanks, solved it!
some more text to make this message > 20 chars

1 Like