The documentation for Paulie API
This site is built using Gatsby and provides access to a set of Serverless Functions hosted on Gatsby Cloud.
It acts as a standalone API for all of my things 🕺.
You can test each of the endpoints, and preview the response using the ▶ Run in browser button.
Latest Tweets
This endpoint uses the Twitter users/${id}/tweets
endpoint under the hood to return a users latest Tweets. Use
this link to find your Twitter id
.
GET
/api/v2/twitter/tweetsJSON
Query | Type | Required | Default |
---|---|---|---|
id | number | true | n/a |
Run in browser
Example request
const response = await (await fetch(`https://paulieapi.gatsbyjs.io/api/v2/twitter/tweets?id=${id}`, {headers: {Authorization: `Bearer ${API_TOKEN}`}})).json();
Example response
{"message": "🕺 Twitter request ok","tweets": [{"author_id": "470012453","entities": {"annotations": [{"start": 23,"end": 27,"probability": 0.9787,"type": "Person","normalized_text": "Brian"}],"mentions": [{"start": 0,"end": 11,"username": "FoodyBrian","id": "1177475647259561987"}]},"text": "@FoodyBrian Ha! thanks Brian!","id": "1554443625878196228","created_at": "2022-08-02T12:26:55.000Z"}]}
Twitter User
This endpoint uses the Twitter users/by/username/${username}
endpoint under the hood to return information about a
Twitter username.
GET
/api/v2/twitter/user JSON
Query | Type | Required | Default |
---|---|---|---|
username | string | true | n/a |
Run in browser
Example request
const response = await (await fetch(`https://paulieapi.gatsbyjs.io/api/v2/twitter/user?username=${username}`, {headers: {Authorization: `Bearer ${process.env.API_TOKEN}`}})).json();
Example response
{"message": "🕺 Twitter request ok","user": {"description": "Senior Software Engineer / DevRel @GatsbyJs","profile_image_url": "https://pbs.twimg.com/profile_images/1230516491084275714/ZnhK4vNX_normal.jpg","created_at": "2012-01-21T07:13:24.000Z","name": "Paul Scanlon","url": "https://t.co/4ABWM2bXYQ","username": "PaulieScanlon","location": "Worthing / UK"...}}
Stripe
Make Stripe Payment
This endpoint uses the Stripe stripe.checkout.sessions.create
method under the hood to create a checkout url for a
user provided payment amount.
POST
/api/v2/stripe/paymentJSON
Parameters | Type | Required | Default |
---|---|---|---|
product | string | true | n/a |
amount | number | true | n/a |
success_url | string | true | n/a |
cancel_url | string | true | n/a |
Run in browser
Example request
const response = await (await fetch('https://paulieapi.gatsbyjs.io/api/v2/stripe/payment', {method: 'POST',body: JSON.stringify({product: 'prod_KAgqqzBEBmuYkT',amount: 5,success_url: 'https://www.mdx-embed.com',cancel_url: 'https://www.mdx-embed.com'})})).json();
Example response
{"message": "🕺 Stripe checkout created ok","url": "https://checkout.stripe.com/pay/cs_test_a1zSrSYeXc5y5DnEbSCsXQ8kYIuV4vaaDcFbOVpZPsTllPfbSFgdtJ9Jtl#fidkdWxOYHwnPyd1blpxYHZxWjA0T1ZVfV9OQTNCQmBHVDcxYmdyQkRON39zbzNBN2J2S0xkZj1RZ003MTJxU3RvNEJBalFPaWxRR0Zib0xwclZPSGZyTzVrTWpMc0tqUlNBQz1ibjJ1c01vNTV%2FZ21Dan9ubycpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl"}
GitHub
GitHub User
This endpoint uses the Octokit octokit.request('GET /users/${username}')
under the hood to return information about a
GitHub username.
GET
/api/v2/github/userJSON
Query | Type | Required | Default |
---|---|---|---|
username | string | true | n/a |
Run in browser
Example request
const response = await (await fetch(`https://paulieapi.gatsbyjs.io/api/v2/github/user?username=${username}`, {headers: {Authorization: `Bearer ${API_TOKEN}`}})).json();
Example response
{"message": "🕺 GitHub request ok","user": {"login": "PaulieScanlon","avatar_url": "https://avatars.githubusercontent.com/u/1465706?v=4","name": "Paul Scanlon","blog": "www.paulie.dev","bio": "Jamstack Developer / Technical Content Writer (freelance)","public_repos": 78,"public_gists": 18,"followers": 203,"following": 55,"private_gists": 1,"total_private_repos": 15,"owned_private_repos": 15...}}
GitHub Repo
This endpoint uses the Octokit GET /repos/{owner}/{repo}
under the hood to return information about a GitHub
repository.
GET
/api/v2/github/repoJSON
Query | Type | Required | Default |
---|---|---|---|
owner | string | true | n/a |
repository | string | true | n/a |
Run in browser
Example request
const response = await (await fetch(`https://paulieapi.gatsbyjs.io/api/v2/github/repo?owner=${owner}&repository=${repository}`, {headers: {Authorization: `Bearer ${API_TOKEN}`}})).json();
Example response
{"message": "🕺 GitHub request ok","repo": {"id": 290021490,"node_id": "MDEwOlJlcG9zaXRvcnkyOTAwMjE0OTA=","name": "mdx-embed","full_name": "PaulieScanlon/mdx-embed","private": false,"owner": {"login": "PaulieScanlon","id": 1465706,"node_id": "MDQ6VXNlcjE0NjU3MDY=","avatar_url": "https://avatars.githubusercontent.com/u/1465706?v=4",...}},...}
GitHub User Events
This endpoint uses the Octokit octokit.request('GET /users/${username}/events')
under the hood to return events for a
GitHub username.
GET
/api/v2/github/user/eventsJSON
Query | Type | Required | Default |
---|---|---|---|
username | string | true | n/a |
results | number | false | 5 |
Run in browser
Example request
const response = await (await fetch(`https://paulieapi.gatsbyjs.io/api/v2/github/user/events?username=${username}&results=${results}`, {headers: {Authorization: `Bearer ${API_TOKEN}`}})).json();
Example response
{"message": "🕺 GitHub request ok","events": [{"id": "17853848747","type": "PushEvent","actor": {"login": "PaulieScanlon","display_login": "PaulieScanlon","url": "https://api.github.com/users/PaulieScanlon","avatar_url": "https://avatars.githubusercontent.com/u/1465706?"},"repo": {"id": 311980309,"name": "PaulieScanlon/paulie-api","url": "https://api.github.com/repos/PaulieScanlon/paulie-api"},...}]}
GitHub Repo Events
This endpoint uses the Octokit octokit.request('GET /repos/{owner}/{repo}/events')
under the hood to return events for
a GitHub repository.
GET
/api/v2/github/repo/eventsJSON
Parameters | Type | Required | Default |
---|---|---|---|
owner | string | true | n/a |
repository | string | true | n/a |
results | number | false | 5 |
Run in browser
Example request
const response = await (await fetch(`https://paulieapi.gatsbyjs.io/api/v2/github/repo/events?owner=${username}&repository=${repository}&results=${results}`,{headers: {Authorization: `Bearer ${API_TOKEN}`}})).json();
Example response
{"message": "🕺 GitHub request ok","events": [{"id": "18049970778","type": "IssueCommentEvent","actor": {"id": 29119,"login": "spacecowb0y","display_login": "spacecowb0y","gravatar_id": "","url": "https://api.github.com/users/spacecowb0y","avatar_url": "https://avatars.githubusercontent.com/u/29119?"},"repo": {"id": 290021490,"name": "PaulieScanlon/mdx-embed","url": "https://api.github.com/repos/PaulieScanlon/mdx-embed"}}]}
GitHub Commits (Year)
This endpoint uses the Octokit octokit.request('GET /repos/{owner}/{repo}/stats/commit_activity')
under the hood to
return 12 months commit history from the current date, for a GitHub repository.
GET
/api/v2/github/repo/commits/yearJSON
Parameters | Type | Required | Default |
---|---|---|---|
owner | string | true | n/a |
repository | string | true | n/a |
Run in browser
Example request
const response = await (await fetch(`https://paulieapi.gatsbyjs.io/api/v2/github/repo/commits/year?owner=${username}&repository=${repository}`,{headers: {Authorization: `Bearer ${API_TOKEN}`}})).json();
Example response
{"message": "🕺 GitHub request ok","commits": [{"total": 5,"week": 1630800000,"date_string": "","days": [0, 0, 0, 4, 1, 0, 0]},{"total": 1,"week": 1631404800,"date_string": "","days": [0, 0, 0, 0, 0, 1, 0]}]}