You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Portal] Fix HTTP method in wallet users API example from POST to GET (#6868)
<!--
## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"
If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):
## Notes for the reviewer
Anything important to call out? Be sure to also clarify these in your comments.
## How to test
Unit tests, playground, etc.
-->
<!-- start pr-codex -->
---
## PR-Codex overview
This PR focuses on updating the documentation for fetching user details from the in-app wallet API, providing clearer instructions, examples, and a new method for retrieving user data.
### Detailed summary
- Changed the title from `Get Users` to `Fetch a Single User`.
- Added detailed instructions for fetching user details via a `GET` request.
- Specified query parameters and their descriptions.
- Included authentication requirements.
- Provided example `curl` commands for fetching user details by email and wallet address.
- Described the response format for the API.
- Introduced convenience methods using the `getUser` method from the thirdweb SDK.
- Updated the command for fetching all users from `POST` to `GET`.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
You can specify the query parameter `queryBy` to query by different user identifiers:
27
+
28
+
-`queryBy`: The parameter to query by. Can be one of `walletAddress`, `email`, `phone`, `externalWalletAddress`, or `id`.
29
+
30
+
You can then specify the value to query by, matching the queryBy parameter:
31
+
32
+
-`walletAddress`: The user's wallet address that thirdweb has generated for them
33
+
-`email`: The user's email address
34
+
-`phone`: The user's phone number
35
+
-`externalWalletAddress`: The user's wallet address that used to login via SIWE
36
+
-`id`: The user's ID (for custom auth)
37
+
38
+
### Authentication
39
+
40
+
You need to include your ThirdWeb Client Secret in the Authorization header.
41
+
42
+
If you are an ecosystem owner, you have to include the `x-ecosystem-id` header and optionally the `x-ecosystem-partner-id` header if the ecosystem is set to partners only.
43
+
44
+
### Example curl Command
45
+
46
+
Here's an example curl command to fetch user details by email:
47
+
48
+
```bash
49
+
50
+
curl -X GET 'https://in-app-wallet.thirdweb.com/api/2023-11-30/embedded-wallet/user-details?queryBy=email&[email protected]' \
51
+
-H 'x-secret-key: YOUR_SECRET_KEY'
52
+
53
+
```
54
+
55
+
Here's an example curl command to fetch user details by address:
56
+
57
+
```bash
58
+
curl -X GET 'https://in-app-wallet.thirdweb.com/api/2023-11-30/embedded-wallet/user-details?queryBy=walletAddress&walletAddress=0x123456789abcdef' \
59
+
-H 'x-secret-key: YOUR_SECRET_KEY'
60
+
```
61
+
62
+
Here's an example curl command to fetch the user details for an ecosystem owner:
63
+
64
+
```bash
65
+
curl -X GET 'https://in-app-wallet.thirdweb.com/api/2023-11-30/embedded-wallet/user-details?queryBy=walletAddress&walletAddress=0x123456789abcdef' \
In both examples, replace `YOUR_SECRET_KEY` with your actual ThirdWeb Client Secret.
72
+
73
+
Replace `YOUR_ECOSYSTEM_ID` and `YOUR_PARTNER_ID` with your actual ecosystem ID and partner ID respectively. The partner ID can be one you set up for yourself as the ecosystem owner.
74
+
75
+
### Response Format
76
+
77
+
The API returns a JSON array with the following structure for each user:
78
+
79
+
```json
80
+
[
81
+
{
82
+
"userId": "string",
83
+
"walletAddress": "string",
84
+
"email": "string (optional)",
85
+
"phone": "string (optional)",
86
+
"createdAt": "string",
87
+
"linkedAccounts": [
88
+
{
89
+
"type": "string",
90
+
"details": {
91
+
"phone": "string",
92
+
// or
93
+
"email": "string",
94
+
// or
95
+
"address": "string",
96
+
// or
97
+
"id": "string",
98
+
// Additional key-value pairs may be present
99
+
}
100
+
}
101
+
]
102
+
}
103
+
]
104
+
```
105
+
106
+
Note: The `details` object in `linkedAccounts` will contain different fields based on the account type. See the [list of Strategies](#list-of-strategies) above for more information.
107
+
108
+
Remember to handle the response appropriately in your chosen programming language, including error cases and parsing the JSON response.
109
+
110
+
### Convenience Methods
111
+
112
+
If you are using the thirdweb SDK, you can use the `getUser` method to retrieve user details.
113
+
114
+
<Stack>
115
+
<ArticleIconCard
116
+
title="getUser"
117
+
icon={TypeScriptIcon}
118
+
description="Get user details from your backend for thirdweb wallets in TypeScript"
119
+
href="/references/typescript/v5/getUser"
120
+
/>
121
+
</Stack>
122
+
123
+
# Fetch All Users
14
124
15
125
Once you have users connecting to your app through in-app wallets, you can fetch all users through our REST API:
16
126
```
@@ -31,7 +141,7 @@ You need to include the following headers:
31
141
Here's an example curl command to pregenerate a thirdweb wallet for the user `[email protected]`:
0 commit comments