🙉Riddles
What do I put here? I forgot.
import requests
# Define the URL for the Shard AI API endpoint.
api_url = "https://api.shard-ai.xyz/v1/fun/riddles?count=1" # Count can be up to 5!
# Provide the authorization token for accessing the API.
authorization_token = "Bearer shard-xxx"
# Define request headers.
headers = {
"Content-Type": "application/json",
"Authorization": authorization_token
}
# Make the request.
response = requests.post(api_url, headers=headers)
print(response.text)
package main
import (
"fmt"
"log"
"github.com/valyala/fasthttp"
)
func main() {
// Define the URL for the Shard fun API endpoint.
apiURL := "https://api.shard-ai.xyz/v1/fun/riddles"
// Provide the authorization token for accessing the API.
authorizationToken := "Bearer shard-xxx"
// Prepare the request.
req := fasthttp.AcquireRequest()
defer fasthttp.ReleaseRequest(req) // Don't forget to release
req.Header.SetContentType("application/json")
req.Header.SetMethod("POST")
req.Header.Set("Authorization", authorizationToken)
req.Header.SetContentType("application/json")
req.SetRequestURI(apiURL)
// Prepare the response.
resp := fasthttp.AcquireResponse()
defer fasthttp.ReleaseResponse(resp) // Don't forget to release
// Send the request.
if err := fasthttp.Do(req, resp); err != nil {
log.Fatalf("Error while making request: %s", err)
}
// Print the response received from the API.
fmt.Println(string(resp.Body()))
}
fetch("https://api.shard-ai.xyz/v1/fun/riddles?count=1", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer shard-xxx"
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
Pro tip: The "count" parameter can be up to 5!
[
"Whats the best API? Shard API."
]
This error means you have exceeded your rate limit! For basic users, your rate limit is a global limit of 15 requests a minute. Upgrade to premium to get more.
{
"error": {
"message": "Something went wrong, try again later.",
"type": "error",
"param": None,
"code": None
}
}
// Sorry, something went wrong, you can try contacting us @ discord.gg/ligma!
Last updated