Definition
- JSON
- Typescript
email.json
{
"id": 0,
"userID": 0,
"emailAddress": "",
"emailVerifiedAt": "",
"status": 0,
"createdAt": "",
"updatedAt": "",
}
email.ts
export interface IEmail {
id: number;
userID: number;
emailAddress: string;
emailVerifiedAt: Date | null;
status: number;
createdAt: Date | null;
updatedAt: Date | null;
}
Get Emails
- Curl
- Typescript
curl -X GET "${baseUrl}/email/?filter=${filter}&orderBy=${orderBy}&page=${page}&pageSize=${pageSize}" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
const response = await fetch("${baseUrl}/email/?filter=${filter}&orderBy=${orderBy}&page=${page}&pageSize=${pageSize}", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Get Email
- Curl
- Typescript
curl -X GET "${baseUrl}/email/${id}" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
const response = await fetch("${baseUrl}/email/${id}", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Apply Email.ID
- Curl
- Typescript
curl -X POST "${baseUrl}/apply/email/id/" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
const response = await fetch("${baseUrl}/apply/email/id/", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
body: JSON.stringify(payload),
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Create Email
- Curl
- Typescript
curl -X POST "${baseUrl}/email/" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d @email.json
信息
email.json
{
"userID": 0,
"emailAddress": "",
"emailVerifiedAt": "",
"status": 0,
}
提示
success status: 201
const response = await fetch("${baseUrl}/email/", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
body: JSON.stringify(payload),
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Update Email
- Curl
- Typescript
#!/bin/bash
curl -X PUT "${baseUrl}/email/${id}" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d @email.json
信息
email.json
{
"userID": 0,
"emailAddress": "",
"emailVerifiedAt": "",
"status": 0,
}
const response = await fetch("${baseUrl}/email/${id}", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
body: JSON.stringify(payload),
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Patch Email
- Curl
- Typescript
curl -X PATCH "${baseUrl}/email/${id}" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Attrs: userID,emailAddress,emailVerifiedAt,status" \
-d @email.json