我非常高兴地宣布我的个人项目 fooapi.com 正式上线!虽然部分功能仍在开发中,但我将持续更新并分享项目进展。fooapi 的核心目标是创建一个统一平台,通过多种方式访问不同主题的虚拟数据,为您的项目和创意提供模拟数据支持。
涵盖数据类型:
详细文档请访问 fooapi.com/docs
目前,您可以通过以下两种方式获取数据:
fooapi.com/playground 提供了一个测试平台,方便您练习和测试您的查询。
以下是一些 fooapi 的应用示例:
生成占位符图片:
只需访问以下链接,即可自定义图片尺寸、背景色、字体色和文本内容:
fooapi.com/imgmaker/700/500/ff0000/000000/foooo

URL 结构:/imgmaker/:width/:height/:bg/:fn/:text
更多信息请访问 fooapi.com/docs/images
地图数据模拟:
使用以下代码获取 3 个城市数据:
<code class="javascript">fetch('https://fooapi.com/api/cities?limit=3')
.then(res => res.json())
.then(data => console.log(data))</code>
这些城市数据均为真实数据,而非人工生成,确保地图应用中坐标的准确性。
获取随机用户信息:
<code class="javascript">fetch('https://fooapi.com/api/users/rand')
.then(res => res.json())
.then(data => console.log(data))</code>返回示例:
<code class="json">{
"id": "1",
"name": "john",
"lastname": "doe",
"username": "johnxdoe11",
"birthdate": "1990-01-01",
"age": 30,
"gender": "male",
"phone": "+63 791 675 8914",
"email": "foo@example.com",
"country": "usa",
"height": 170,
"weight": 70
}</code>社交媒体数据模拟:
<code class="javascript">fetch('https://fooapi.com/api/comments')
.then(res => res.json())
.then(data => console.log(data))</code>返回示例:
<code class="json">[
{
"id": "1",
"comment": "Sunshine and sci-fi sounds like a perfect combo! Enjoy getting lost in your book ",
"reactions": 0,
"postId": "1",
"user": {
"id": "50",
"name": "John",
"lastname": "Smith",
"username": "SmiJohnxD100"
}
},
{
"id": "2",
"comment": "Don't forget the sunscreen! What sci-fi are you reading?",
"reactions": 1,
"postId": "1",
"user": {
"id": "2",
"name": "Akira",
"lastname": "Von Trier",
"username": "alphaVonAkirax853"
}
}
// ...更多数据
]</code>您可以自由探索其他数据类别。
欢迎您提供宝贵的反馈意见!fooapi 可用于模拟各种应用、设计和模型。如果您有任何关于新数据类别或功能的建议,请随时在评论区分享。
以上就是为开发者提供的一体化 Fake API的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号