ผู้ใช้: รับ

ต้องมีการให้สิทธิ์

เรียกข้อมูลผู้ใช้ตามรหัสผู้ใช้ ลองเลยหรือดูตัวอย่าง

ส่งคำขอ

คำขอ HTTP

GET https://www.googleapis.com/blogger/v3/users/userId

พารามิเตอร์

ชื่อพารามิเตอร์ ค่า คำอธิบาย
พารามิเตอร์ที่จำเป็น
userId string อาจเป็นรหัสตัวเลขของผู้ใช้ปัจจุบัน หรือ self

การให้สิทธิ์

คำขอนี้ต้องได้รับการให้สิทธิ์ที่มีขอบเขตต่อไปนี้อย่างน้อย 1 ขอบเขต (อ่านเพิ่มเติมเกี่ยวกับการตรวจสอบสิทธิ์และการให้สิทธิ์)

ขอบเขต
https://www.googleapis.com/auth/blogger
https://www.googleapis.com/auth/blogger.readonly

เนื้อหาของคำขอ

โปรดอย่าให้เนื้อหาคำขอตามวิธีการนี้

คำตอบ

หากสำเร็จ เมธอดนี้จะแสดงทรัพยากรผู้ใช้ในเนื้อหาการตอบกลับ

ตัวอย่าง

หมายเหตุ: ตัวอย่างโค้ดที่มีสำหรับวิธีการนี้ไม่ได้แสดงถึงภาษาโปรแกรมที่รองรับทั้งหมด (ดูรายการภาษาที่รองรับได้ในหน้าไลบรารีของไคลเอ็นต์)

Java

ใช้ไลบรารีของไคลเอ็นต์ Java

// Configure the Java API Client for Installed Native App
HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
JsonFactory JSON_FACTORY = new JacksonFactory();
// Configure the Installed App OAuth2 flow.
Credential credential = OAuth2Native.authorize(HTTP_TRANSPORT,
JSON_FACTORY, new LocalServerReceiver(),
Arrays.asList(BloggerScopes.BLOGGER));
// Construct the Blogger API access facade object.
Blogger blogger = Blogger.builder(HTTP_TRANSPORT, JSON_FACTORY)
.setApplicationName("Blogger-UsersGet-Snippet/1.0")
.setHttpRequestInitializer(credential).build();
// The request action.
Get usersGetAction = blogger.users().get("self");
// Restrict the result content to just the data we need.
usersGetAction.setFields("displayName,url");
// This step sends the request to the server.
User user = usersGetAction.execute();
// Now we can navigate the response.
System.out.println("Display Name: " + user.getDisplayName());
System.out.println("Profile URL: " + user.getUrl());

ลองใช้เลย

ใช้ API Explorer ด้านล่างเพื่อเรียกใช้เมธอดนี้กับข้อมูลแบบสดและดูการตอบกลับ