cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get user's account info

Get user's account info

Alex_Shekunsky
Explorer | Level 4
Go to solution

Hi!

I need help.

How i can get linked user's dropbox account info (name/email) in Objective-c by API v2 ?

In v1 i did this by 

[self.restClient loadAccountInfo];

in method:

- (void)restClient:(DBRestClient*)client loadedAccountInfo:(DBAccountInfo*)info

Thanks!

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

If you're using the API v2 Objective-C SDK, the equivalent method is getCurrentAccount:

 

https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBUSERSRoutes.html#/c:objc(cs)DB...

 

Here's an example of how you would make an "RPC-style" request like that (for creating a folder in this case):

 

https://github.com/dropbox/dropbox-sdk-obj-c#rpc-style-request

 

Xcode should auto-complete most of the boilerplate code for you though.

View solution in original post

3 Replies 3

Greg-DB
Dropbox Staff
Go to solution

If you're using the API v2 Objective-C SDK, the equivalent method is getCurrentAccount:

 

https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBUSERSRoutes.html#/c:objc(cs)DB...

 

Here's an example of how you would make an "RPC-style" request like that (for creating a folder in this case):

 

https://github.com/dropbox/dropbox-sdk-obj-c#rpc-style-request

 

Xcode should auto-complete most of the boilerplate code for you though.

Alex_Shekunsky
Explorer | Level 4
Go to solution

Thank you very much!

tomsax
New member | Level 2
Go to solution

If you have a DBUserClient object (e.g. from [DBClientsManager authorizedClient]), you can get the info for that account with this call:

 

[[client.usersRoutes getCurrentAccount] setResponseBlock:^(DBUSERSFullAccount * _Nullable result, DBNilObject * _Nullable routeError, DBRequestError * _Nullable networkError)
{
	if (networkError != nil)
	{
		NSLog(@"getCurrentAccount failed: network error");
	}
	else if (routeError != nil)
	{
		NSLog(@"getCurrentAccount failed: route error");
	}
	else
	{
		NSLog(@"got Dropbox account email: %@", result.email);
	}
}];
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    tomsax New member | Level 2
  • User avatar
    Alex_Shekunsky Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?