-
Notifications
You must be signed in to change notification settings - Fork 0
REST_API_Endpoints
- Last Modified: 2024-04-27
- Author: Phill Weston
This document provides a detailed description of the REST API endpoints for the Lotso-Twitter-Auth service. The service is responsible for authenticating users via Twitter and performing various actions such as retweeting, liking, and bookmarking tweets.
In PowerShell, you can use the Invoke-WebRequest
cmdlet to send HTTP requests. Here's how you can revise your curl
command to work in PowerShell:
$sessionID = "your_session_id"
$uri = "curl_uri_with_parameters"
$cookie = New-Object System.Net.Cookie("JSESSIONID", $sessionID, "/", "api.btiplatform.com")
$cookieContainer = New-Object System.Net.CookieContainer
$cookieContainer.Add($cookie)
$response = Invoke-WebRequest -Uri $uri -WebSession (New-Object Microsoft.PowerShell.Commands.WebRequestSession -Property @{Cookies = $cookieContainer})
$response.Content
The following endpoints including authentication from the frontend website, callback from the Twitter server and authentication check.
-
GET /start-auth
-
Description: Retrieves the transaction count for a given address.
-
Parameters:
-
callback
: The URL to redirect to after authentication.
-
-
Credentials: false
-
Response:
- None
-
Example:
Request:
curl --location 'https://api.btiplatform.com/start-auth?callback=https://lotso.org/twitter-callback'
Response:
{ "code": 0, "message": "Success", "error": "", "data": "" }
-
-
GET /twitter-callback
-
Description: Handles the callback from Twitter and exchanges the request token for an access token.
-
Parameters:
-
oauth_token
: The request token. -
oauth_verifier
: The verifier.
-
-
Credentials: false
-
Response:
- None
-
Example:
Request:
curl --location 'https://api.btiplatform.com/start-auth?oauth_token=xxxxxxxx&oauth_verifier=xxxxxxxx'
Response:
{ "code": 0, "message": "Success", "error": "", "data": "" }
-
-
GET /check-auth-status
-
Description: Checks if the user is authenticated.
-
Parameters:
- None
-
Credentials: true
-
Response:
-
isAuthenticated
: Boolean value indicating if the user is authenticated.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/check-auth-status'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "isAuthenticated": true } }
-
-
GET /retweet
-
Description: Retweets a tweet.
-
Parameters:
-
tweetId
: The ID of the tweet.
-
-
Credentials: true
-
Response:
- Promise object.
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/retweet?tweetId=1776604915093422222'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "tweetId": "1776604915093422222", "retweeted": true } }
-
-
GET /like
-
Description: Likes a tweet.
-
Parameters:
-
tweetId
: The ID of the tweet.
-
-
Credentials: true
-
Response:
- Promise object.
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/like?tweetId=1776604915093422222'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "tweetId": "1776604915093422222", "liked": true } }
-
-
GET /bookmark
-
Description: Bookmarks a tweet.
-
Parameters:
-
tweetId
: The ID of the tweet.
-
-
Credentials: true
-
Response:
- Promise object.
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/bookmark?tweetId=1776604915093422222'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "tweetId": "1776604915093422222", "bookmarked": true } }
-
-
GET /follow-us
-
Description: Follows the user.
-
Parameters:
-
userName
: The ID of the user.
-
-
Credentials: true
-
Response:
- Promise object.
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/follow-us?userName=LotsoFandom'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "userId": "1234567890", "userName": "LotsoFandom", "following": true } }
-
-
GET /check-retweet
-
Description: Checks if the user has retweeted a tweet.
-
Parameters:
-
tweetId
: The ID of the tweet.
-
-
Credentials: true
-
Response:
-
isRetweeted
: Boolean value indicating if the user has retweeted the tweet.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/check-retweet?tweetId=1776604915093422222'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "isRetweeted": true } }
-
-
GET /check-follow
-
Description: Checks if the user is following a user.
-
Parameters:
-
userName
: The ID of the user.
-
-
Credentials: true
-
Response:
-
isFollowing
: Boolean value indicating if the user is following the user.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/check-follow?userName=LotsoFandom'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "isFollowing": true } }
-
-
GET /check-like
-
Description: Checks if the user has liked a tweet.
-
Parameters:
-
tweetId
: The ID of the tweet.
-
-
Credentials: true
-
Response:
-
isLiked
: Boolean value indicating if the user has liked the tweet.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/check-like?tweetId=1776604915093422222'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "isLiked": true } }
-
-
GET /check-bookmark
-
Description: Checks if the user has bookmarked a tweet.
-
Parameters:
-
tweetId
: The ID of the tweet.
-
-
Credentials: true
-
Response:
-
isBookmarked
: Boolean value indicating if the user has bookmarked the tweet.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/check-bookmark?tweetId=1776604915093422222'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "isBookmarked": true } }
-
-
GET /check-airdrop
-
Description: Check if the user has already claimed the airdrop.
-
Parameters:
-
address
: The address of the user.
-
-
Credentials: true
-
Response:
-
hasClaimed
: Boolean value indicating if the user has claimed the airdrop.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/check-airdrop?address=0x460c3449a7E6695AF830008CB0a3b118B02aB30e'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "hasClaimed": true } }
-
-
GET /log-airdrop
-
Description: Logs the airdrop claim.
-
Parameters:
-
address
: The address of the user.
-
-
Credentials: true
-
Response:
-
isLogged
: Boolean value indicating if the airdrop claim has been logged.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/log-airdrop?address=0x460c3449a7E6695AF830008CB0a3b118B02aB30e'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "isLogged": true } }
-
-
GET /check-airdrop-amount
-
Description: Check the amount of airdrop claimed by the user.
-
Parameters:
-
address
: The address of the user. -
promotionCode
: The promotion code. -
step
: The steps which the user has completed.
-
-
Credentials: true
-
Response: (Same as
POST /v1/info/set_airdrop
)-
address
: Wallet address of the current user, should be the same as the input address. -
transaction_count
(Integer): The number of transactions associated with the address. -
airdrop_count
(Integer): The airdrop count for the address. -
has_airdropped_count
(Boolean): The number of airdrops that have been issued to this address. -
scheduled_delivery
(String): The next available time for airdropping.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/check-airdrop-amount?address=0x460c3449a7E6695AF830008CB0a3b118B02aB30e&promotionCode=abcdefghijklmnop&step=2'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "address": "0x0000000000000000000000000000000000000001", "transaction_count": 0, "airdrop_count": 10000, "has_airdropped_count": 0, "scheduled_delivery": "2024-04-01T08:00:00Z" } }
-
-
GET /generate-promotion-code
-
Description: Generate a promotion code for the user.
-
Parameters:
-
address
: The address of the user.
-
-
Credentials: true
-
Response:
-
promotion_code
: The promotion code.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/generate-promotion-code?address=0x460c3449a7E6695AF830008CB0a3b118B02aB30e'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "promotion_code": "abcdefghijklmnop" } }
-
-
GET /send-airdrop-parent
-
Description: Send airdrop to the parent for reward (50,000 by default).
-
Parameters:
-
address
: The address of the user.
-
-
Credentials: true
-
Response: (Same as
POST /v1/info/append_airdrop
)-
address
: Wallet address of the current user, should be the same as the input address. -
transaction_count
(Integer): The number of transactions associated with the address. -
airdrop_count
(Integer): The airdrop count for the address. -
has_airdropped_count
(Boolean): The number of airdrops that have been issued to this address. -
scheduled_delivery
(String): The next available time for airdropping.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/send-airdrop-parent?address=0x460c3449a7E6695AF830008CB0a3b118B02aB30e'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "address": "0x0000000000000000000000000000000000000001", "transaction_count": 11, "airdrop_count": 100000, "has_airdropped_count": 0, "scheduled_delivery": "2024-04-01T08:00:00Z" } }
-
-
GET /check-purchase
-
Description: Check the purchase status of the user.
-
Parameters:
-
address
: The address of the user.
-
-
Credentials: true
-
Response:
-
purchase
: Boolean value indicating if the user is eligible for the airdrop.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/check-purchase?address=0x460c3449a7E6695AF830008CB0a3b118B02aB30e'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "purchase": true } }
-
-
GET /check-reward-amount
-
Description: Check the total reward amount of the user.
-
Parameters:
-
address
: The address of the user.
-
-
Credentials: false
-
Response:
-
totalRewardAmount
: The total reward amount of the user.
-
-
Example:
Request:
curl --location 'https://api.btiplatform.com/check-reward-amount?address=0x460c3449a7E6695AF830008CB0a3b118B02aB30e'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "totalRewardAmount": 50000 } }
-
-
GET /subscription-info
-
Description: Log the subscription information of the user.
-
Parameters:
-
email
: The email of the user. -
name
: The name of the user. -
info
: The subscription information.
-
-
Credentials: false
-
Response:
-
isLogged
: Boolean value indicating if the subscription information has been logged. -
isUpdated
: Boolean value indicating if the subscription information has been updated.
-
-
Example:
Request:
curl --location --cookie "JSESSIONID=your_session_id" 'https://api.btiplatform.com/subscription-info?email=2436559745@qq.com&name=Lotso&info=LotsoFandom'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "isLogged": true, "isUpdated": true } }
-
-
GET /v1/info/recipient_info
-
Description: Get the subscription information of the user.
-
Parameters:
- None
-
Credentials: false
-
Response:
-
count
: The number of recipients. -
amount
: The total amount of airdrop.
-
-
Example:
Request:
curl --location 'https://api.btiplatform.com/v1/info/recipient_info'
Response:
{ "code": 0, "message": "Success", "error": "", "data": { "count": 1, "amount": 50000 } }
-