Skip to content

Users

主要用於 profile share 頁面(公開給登入用戶)

[GET][AUTH] /api/users/:username

取得用戶資訊,開頭為 @ 例如用戶名 yish,網址則為:https://aa.com/api/users/@yish

response

json
{
	"data": {
		"id": 1,
		"name": "h11eel",
		"username": "yish",
		"email": "1311311111@tt.com",
		"email_verified_at": null,
		"two_factor_secret": null,
		"two_factor_recovery_codes": null,
		"created_at": "2024-06-29T15:52:36.000000Z",
		"updated_at": "2024-06-29T15:52:36.000000Z"
	}
}

[GET][AUTH] /api/:username/followings

取得用戶追蹤中的使用者。

response

json
{
	"data": [
		{
			"id": 2,
			"name": "Dr. Sandra Swift III",
			"username": "ocie39",
			"email": "anna99@example.com",
			"email_verified_at": "2024-06-29T15:52:59.000000Z",
			"two_factor_secret": null,
			"two_factor_recovery_codes": null,
			"created_at": "2024-06-29T15:52:59.000000Z",
			"updated_at": "2024-06-29T15:52:59.000000Z",
			"pivot": {
				"subject_type": "user",
				"user_id": 1,
				"subject_id": 2,
				"id": 32,
				"relation": "follow",
				"relation_value": null,
				"relation_type": null,
				"created_at": "2024-06-29T15:56:30.000000Z",
				"updated_at": "2024-06-29 15:56:30"
			}
		},
	],
	"links": {
		"first": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followings?page=1",
		"last": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followings?page=3",
		"prev": null,
		"next": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followings?page=2"
	},
	"meta": {
		"current_page": 1,
		"from": 1,
		"last_page": 3,
		"links": [
			{
				"url": null,
				"label": "« Previous",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followings?page=1",
				"label": "1",
				"active": true
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followings?page=2",
				"label": "2",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followings?page=3",
				"label": "3",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followings?page=2",
				"label": "Next »",
				"active": false
			}
		],
		"path": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followings",
		"per_page": 10,
		"to": 10,
		"total": 30
	}
}

[GET][AUTH] /api/:username/followers

取得追蹤用戶的使用者。

response

json
{
	"data": [
		{
			"id": 2,
			"name": "Dr. Sandra Swift III",
			"username": "ocie39",
			"email": "anna99@example.com",
			"email_verified_at": "2024-06-29T15:52:59.000000Z",
			"two_factor_secret": null,
			"two_factor_recovery_codes": null,
			"created_at": "2024-06-29T15:52:59.000000Z",
			"updated_at": "2024-06-29T15:52:59.000000Z",
			"pivot": {
				"subject_type": "user",
				"subject_id": 1,
				"user_id": 2,
				"id": 2,
				"relation": "follow",
				"relation_value": null,
				"relation_type": null,
				"created_at": "2024-06-29T15:54:08.000000Z",
				"updated_at": "2024-06-29 15:54:08"
			}
		},
			],
	"links": {
		"first": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followers?page=1",
		"last": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followers?page=3",
		"prev": null,
		"next": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followers?page=2"
	},
	"meta": {
		"current_page": 1,
		"from": 1,
		"last_page": 3,
		"links": [
			{
				"url": null,
				"label": "« Previous",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followers?page=1",
				"label": "1",
				"active": true
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followers?page=2",
				"label": "2",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followers?page=3",
				"label": "3",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followers?page=2",
				"label": "Next »",
				"active": false
			}
		],
		"path": "http:\/\/nordpress-next.test\/api\/users\/@yish\/followers",
		"per_page": 10,
		"to": 10,
		"total": 30
	}
}

取得用戶最近發佈的連結清單。

response

json
{
	"data": [
		{
			"id": 1,
			"user_id": 2,
			"host": "https:\/\/yish.dev",
			"url": "https:\/\/yish.dev\/posts\/backpack-nova-filamentphp\/",
			"title": "Laravel backpack vs Laravel nova vs FilamentPHP",
			"published_at": "2024-06-18T11:37:21.000000Z",
			"options": {
				"icon": "https:\/\/yish.dev\/apple-touch-icon.png",
				"image": "https:\/\/yish.dev\/1200.png",
				"favicon": "https:\/\/yish.dev\/favicon.ico",
				"authorName": "Yish",
				"description": "FilamentPHP is a next generation and full stack package (TALL), it’s really great and easy to use for your admin panel and CMS. Laravel backpack In 2016, when I was a SOHO, I used Backpack as my main stack to build projects for my customers. It’s really flexible and customizable if you understand the author’s design philosophy. I could add any packages and functions I wanted into these projects created with Laravel Backpack.",
				"providerName": "Yish"
			},
			"status": "inbox",
			"created_at": "2024-07-04T15:32:54.000000Z",
			"updated_at": "2024-07-04T15:32:54.000000Z",
			"deleted_at": null,
			"type": "article"
		},
		{
			"id": 2,
			"user_id": 2,
			"host": "https:\/\/yish.dev",
			"url": "https:\/\/yish.dev\/posts\/backpack-nova-filamentphp\/",
			"title": "Laravel backpack vs Laravel nova vs FilamentPHP",
			"published_at": "2024-06-18T11:37:21.000000Z",
			"options": {
				"icon": "https:\/\/yish.dev\/apple-touch-icon.png",
				"image": "https:\/\/yish.dev\/1200.png",
				"favicon": "https:\/\/yish.dev\/favicon.ico",
				"authorName": "Yish",
				"description": "FilamentPHP is a next generation and full stack package (TALL), it’s really great and easy to use for your admin panel and CMS. Laravel backpack In 2016, when I was a SOHO, I used Backpack as my main stack to build projects for my customers. It’s really flexible and customizable if you understand the author’s design philosophy. I could add any packages and functions I wanted into these projects created with Laravel Backpack.",
				"providerName": "Yish"
			},
			"status": "inbox",
			"created_at": "2024-07-04T15:33:04.000000Z",
			"updated_at": "2024-07-04T15:33:04.000000Z",
			"deleted_at": null,
			"type": "article"
		},
		{
			"id": 3,
			"user_id": 2,
			"host": "https:\/\/yish.dev",
			"url": "https:\/\/yish.dev\/posts\/backpack-nova-filamentphp\/",
			"title": "Laravel backpack vs Laravel nova vs FilamentPHP",
			"published_at": "2024-06-18T11:37:21.000000Z",
			"options": {
				"icon": "https:\/\/yish.dev\/apple-touch-icon.png",
				"image": "https:\/\/yish.dev\/1200.png",
				"favicon": "https:\/\/yish.dev\/favicon.ico",
				"authorName": "Yish",
				"description": "FilamentPHP is a next generation and full stack package (TALL), it’s really great and easy to use for your admin panel and CMS. Laravel backpack In 2016, when I was a SOHO, I used Backpack as my main stack to build projects for my customers. It’s really flexible and customizable if you understand the author’s design philosophy. I could add any packages and functions I wanted into these projects created with Laravel Backpack.",
				"providerName": "Yish"
			},
			"status": "inbox",
			"created_at": "2024-07-04T15:33:05.000000Z",
			"updated_at": "2024-07-04T15:33:05.000000Z",
			"deleted_at": null,
			"type": "article"
		}
	],
	"links": {
		"first": "http:\/\/nordpress-next.test\/api\/users\/@yish\/links?page=1",
		"last": "http:\/\/nordpress-next.test\/api\/users\/@yish\/links?page=1",
		"prev": null,
		"next": null
	},
	"meta": {
		"current_page": 1,
		"from": 1,
		"last_page": 1,
		"links": [
			{
				"url": null,
				"label": "« Previous",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/links?page=1",
				"label": "1",
				"active": true
			},
			{
				"url": null,
				"label": "Next »",
				"active": false
			}
		],
		"path": "http:\/\/nordpress-next.test\/api\/users\/@yish\/links",
		"per_page": 10,
		"to": 5,
		"total": 5
	}
}

[GET][AUTH] /api/users/:username/highlights

取得用戶最近發佈的重點清單。

response

json
{
	"data": [
		{
			"id": 1,
			"user_id": 2,
			"link_id": 1,
			"content": "h1113sasdas21ello!!",
			"created_at": "2024-07-04T15:34:59.000000Z",
			"updated_at": "2024-07-04T15:34:59.000000Z",
			"deleted_at": null,
			"link": {
				"id": 1,
				"user_id": 2,
				"host": "https:\/\/yish.dev",
				"url": "https:\/\/yish.dev\/posts\/backpack-nova-filamentphp\/",
				"title": "Laravel backpack vs Laravel nova vs FilamentPHP",
				"published_at": "2024-06-18T11:37:21.000000Z",
				"options": {
					"icon": "https:\/\/yish.dev\/apple-touch-icon.png",
					"image": "https:\/\/yish.dev\/1200.png",
					"favicon": "https:\/\/yish.dev\/favicon.ico",
					"authorName": "Yish",
					"description": "FilamentPHP is a next generation and full stack package (TALL), it’s really great and easy to use for your admin panel and CMS. Laravel backpack In 2016, when I was a SOHO, I used Backpack as my main stack to build projects for my customers. It’s really flexible and customizable if you understand the author’s design philosophy. I could add any packages and functions I wanted into these projects created with Laravel Backpack.",
					"providerName": "Yish"
				},
				"status": "inbox",
				"created_at": "2024-07-04T15:32:54.000000Z",
				"updated_at": "2024-07-04T15:32:54.000000Z",
				"deleted_at": null,
				"type": "article"
			}
		},
		{
			"id": 2,
			"user_id": 2,
			"link_id": 1,
			"content": "h1113sasdas21ello!!",
			"created_at": "2024-07-04T15:35:00.000000Z",
			"updated_at": "2024-07-04T15:35:00.000000Z",
			"deleted_at": null,
			"link": {
				"id": 1,
				"user_id": 2,
				"host": "https:\/\/yish.dev",
				"url": "https:\/\/yish.dev\/posts\/backpack-nova-filamentphp\/",
				"title": "Laravel backpack vs Laravel nova vs FilamentPHP",
				"published_at": "2024-06-18T11:37:21.000000Z",
				"options": {
					"icon": "https:\/\/yish.dev\/apple-touch-icon.png",
					"image": "https:\/\/yish.dev\/1200.png",
					"favicon": "https:\/\/yish.dev\/favicon.ico",
					"authorName": "Yish",
					"description": "FilamentPHP is a next generation and full stack package (TALL), it’s really great and easy to use for your admin panel and CMS. Laravel backpack In 2016, when I was a SOHO, I used Backpack as my main stack to build projects for my customers. It’s really flexible and customizable if you understand the author’s design philosophy. I could add any packages and functions I wanted into these projects created with Laravel Backpack.",
					"providerName": "Yish"
				},
				"status": "inbox",
				"created_at": "2024-07-04T15:32:54.000000Z",
				"updated_at": "2024-07-04T15:32:54.000000Z",
				"deleted_at": null,
				"type": "article"
			}
		}
	],
	"links": {
		"first": "http:\/\/nordpress-next.test\/api\/users\/@yish\/highlights?page=1",
		"last": "http:\/\/nordpress-next.test\/api\/users\/@yish\/highlights?page=2",
		"prev": null,
		"next": "http:\/\/nordpress-next.test\/api\/users\/@yish\/highlights?page=2"
	},
	"meta": {
		"current_page": 1,
		"from": 1,
		"last_page": 2,
		"links": [
			{
				"url": null,
				"label": "« Previous",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/highlights?page=1",
				"label": "1",
				"active": true
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/highlights?page=2",
				"label": "2",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/highlights?page=2",
				"label": "Next »",
				"active": false
			}
		],
		"path": "http:\/\/nordpress-next.test\/api\/users\/@yish\/highlights",
		"per_page": 10,
		"to": 10,
		"total": 16
	}
}

[GET][AUTH] /api/users/:username/notes

取得用戶最近發佈的筆記清單。

response

json
{
	"data": [
		{
			"id": 1,
			"user_id": 2,
			"content": "121212",
			"created_at": "2024-07-04T15:36:19.000000Z",
			"updated_at": "2024-07-04T15:36:19.000000Z",
			"deleted_at": null,
			"links": [],
			"highlights": []
		},
		{
			"id": 2,
			"user_id": 2,
			"content": "121212",
			"created_at": "2024-07-04T15:36:20.000000Z",
			"updated_at": "2024-07-04T15:36:20.000000Z",
			"deleted_at": null,
			"links": [],
			"highlights": []
		}
	],
	"links": {
		"first": "http:\/\/nordpress-next.test\/api\/users\/@yish\/notes?page=1",
		"last": "http:\/\/nordpress-next.test\/api\/users\/@yish\/notes?page=1",
		"prev": null,
		"next": null
	},
	"meta": {
		"current_page": 1,
		"from": 1,
		"last_page": 1,
		"links": [
			{
				"url": null,
				"label": "« Previous",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/notes?page=1",
				"label": "1",
				"active": true
			},
			{
				"url": null,
				"label": "Next »",
				"active": false
			}
		],
		"path": "http:\/\/nordpress-next.test\/api\/users\/@yish\/notes",
		"per_page": 10,
		"to": 6,
		"total": 6
	}
}

[GET][AUTH] /api/users/:username/likes/:type

取得用戶最近點讚清單。(鼓勵性質)

type in: [link, note, highlight, collection]

json
{
	"data": [
		{
			"id": 1,
			"user_id": 1,
			"host": "http:\/\/yundt.com\/unde-nostrum-quae-quo-non-quidem-id-voluptatum.html",
			"url": "https:\/\/schuppe.com\/eos-hic-sit-in-unde-et.html",
			"title": "Soluta ducimus commodi rerum accusamus eos voluptas eveniet quo.",
			"published_at": "2024-07-06T14:49:12.000000Z",
			"options": {
				"icon": "https:\/\/www.walter.com\/quaerat-nemo-saepe-velit-ipsam-id-quidem-nesciunt-odit",
				"image": "http:\/\/greenholt.biz\/",
				"favicon": "http:\/\/mclaughlin.org\/sapiente-recusandae-placeat-omnis-ea-beatae-eius-qui",
				"authorName": "Dr. Jarvis Schinner",
				"description": "Animi sed dolor laborum suscipit omnis.",
				"providerName": "Moen, Luettgen and Kihn"
			},
			"status": "inbox",
			"created_at": "2024-07-06T14:49:12.000000Z",
			"updated_at": "2024-07-06T14:49:12.000000Z",
			"deleted_at": null,
			"type": "article",
			"pivot": {
				"subject_type": "link",
				"user_id": 1,
				"subject_id": 1,
				"id": 1,
				"relation": "like",
				"relation_value": null,
				"relation_type": null,
				"created_at": "2024-07-06T14:55:54.000000Z",
				"updated_at": "2024-07-06 14:55:54"
			}
		},
			],
	"links": {
		"first": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=1",
		"last": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=10",
		"prev": null,
		"next": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=2"
	},
	"meta": {
		"current_page": 1,
		"from": 1,
		"last_page": 10,
		"links": [
			{
				"url": null,
				"label": "« Previous",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=1",
				"label": "1",
				"active": true
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=2",
				"label": "2",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=3",
				"label": "3",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=4",
				"label": "4",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=5",
				"label": "5",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=6",
				"label": "6",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=7",
				"label": "7",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=8",
				"label": "8",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=9",
				"label": "9",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=10",
				"label": "10",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes?page=2",
				"label": "Next »",
				"active": false
			}
		],
		"path": "http:\/\/nordpress-next.test\/api\/users\/@yish\/likes",
		"per_page": 10,
		"to": 10,
		"total": 100
	}
}

[GET][AUTH] /api/users/:username/favorites/:type

取得用戶最近最愛清單。(最愛)

type in: [link, note, highlight, collection]

Same as above.

[GET][AUTH] /api/users/:username/collections

取得用戶最近建立收藏清單。

json
{
	"data": [],
	"links": {
		"first": "http:\/\/nordpress-next.test\/api\/users\/@yish\/collections?page=1",
		"last": "http:\/\/nordpress-next.test\/api\/users\/@yish\/collections?page=1",
		"prev": null,
		"next": null
	},
	"meta": {
		"current_page": 1,
		"from": null,
		"last_page": 1,
		"links": [
			{
				"url": null,
				"label": "« Previous",
				"active": false
			},
			{
				"url": "http:\/\/nordpress-next.test\/api\/users\/@yish\/collections?page=1",
				"label": "1",
				"active": true
			},
			{
				"url": null,
				"label": "Next »",
				"active": false
			}
		],
		"path": "http:\/\/nordpress-next.test\/api\/users\/@yish\/collections",
		"per_page": 10,
		"to": null,
		"total": 0
	}
}

[POST][AUTH][CURRENT_USER] /api/users/:id/follows/toggle

當前登入用戶跟隨/取消跟隨指定用戶。

  • :id = user_id

response

json
{
	"data": {
		"attached": [
			3
		],
		"detached": [],
		"count": 1
	}
}

[PUT][AUTH][CURRENT_USER] /api/users/update

更新當前用戶名稱或者使用者名稱。

validation

  • name: sometimes, rquired, str:255
  • username: sometimes, rquired, str:255, unique

request

json
{
	"username": "hello1"
}

response

json
{
	"data": {
		"id": "9c6729b5-48b8-4cbc-8b95-cc3f1fadb296",
		"name": "h11eel",
		"username": "hello1",
		"email": "13131@tt.com",
		"email_verified_at": null,
		"two_factor_secret": null,
		"two_factor_recovery_codes": null,
		"created_at": "2024-06-29T13:49:13.000000Z",
		"updated_at": "2024-06-29T13:49:21.000000Z"
	}
}