Account/update profile/en

Jump to: navigation, search



Update profile of the authenticating user.


Supported Formats


HTTP Request Method


Requires Authentication

See the Authorization Mechanism Statement for authorization details

Requests Count Limitation

See the Interface Access Rights Statement for the Request Count Limitaiton details.

Request Parameters

  Requires Type and Range Description
source true string AppKey for the application to identify it. ( This parameter is not needed when using OAuth)
You Must use at least one of the parameters below, multi-parameters are also accepted.
name false string nick, limited by 20 Chinese characters.
gender false string Gender, m means male, f means female.
province false int Province code, see Province and city code table
city false int City code, 1000 means undefined city. see Province and city code table
description false string Personal description. Limited by 160 Chinese characters.


  • After API is called successfully, only the items in parameters are updated, others are not changed.
  • For example, if name and gender have been set, only name and gender will be updated. User’s province, city and personal description will not be changed.

Example Request

curl -u "username:password" -d "gender=m&name=openapi" ""
curl -u "username:password" -d "gender=m&name=openapi" ""


XML Example

 <?xml version="1.0" encoding="UTF-8"?>
    <location>广东 广州</location>
    <created_at>Thu Jan 01 08:00:00 +0800 1970</created_at>
      <created_at>Fri Dec 25 17:57:27 +0800 2009</created_at>
        <a id="0" href="">Web</a>

JSON Example

    "created_at":"Thu Jan 01 08:00:00 +0800 1970",
          {"created_at":"Thu Jan 07 17:36:07 +0800 2010",
          "source":"<a id=\"0\" href=\"\" rel=\"nofollow\">Web</a>",


Java Example

Please download Java SDK from . Weibo SDK Development Kit Dowload Site
Sample Code:

package weibo4j.examples;

import weibo4j.User;
import weibo4j.Weibo;

public class OAuthUpdateProfile {

	 * Usage: java -DWeibo4j.oauth.consumerKey=[consumer key]
	 * -DWeibo4j.oauth.consumerSecret=[consumer secret]
	 * Weibo4j.examples.OAuthUpdateProfile [accessToken] [accessSecret]
	 * [imageFilePath]
	 * @param args
	 *            message
	public static void main(String[] args) {
		try {
			if (args.length < 3) {
	                "Usage: java weibo4j.examples.OAuthUpdateProfile token tokenSecret filePath");
	            System.exit( -1);
			System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
			System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);

			Weibo weibo = new Weibo();
			 * 此处需要填写AccessToken的key和Secret,可以从OAuthUpdate的执行结果中拷贝过来
			weibo.setToken(args[0], args[1]);
			try {
				User user = weibo.updateProfile(args[2],args[3],args[4],args[5],args[6]);
			} catch (Exception e1) {
		} catch (Exception ioe) {
			System.out.println("Failed to read the system input.");

PHP Example

Please download PHP SDK with OAUTH supported from Weibo SDK Development Kit Dowload Site
. Sample Code:

$c = new WeiboClient( WB_AKEY , 
                      WB_SKEY , 
                      $_SESSION['last_key']['oauth_token'] , 
                      $_SESSION['last_key']['oauth_token_secret']  );
//name you want to change to
$name = 'name';
//gender you want to change to
$gender = 'f';
$param = array();
$param['name'] = $name;
$param['gender']= $gender;
$msg = $c->oauth->post('',$param);
if ($msg === false || $msg === null){
	echo "Error occured";
	return false;
if (isset($msg['error_code']) && isset($msg['error'])){
	echo ('Error_code: '.$msg['error_code'].';  Error: '.$msg['error'] );
	return false;
if (isset($msg['name'])){

文档更新时间: 21 January 2011