Get Current Weather
curl --request POST \
--url https://api.aisa.one/apis/v1/api-ninjas/get-weather \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"city": "London",
"country": "United States",
"lat": 51.5074,
"lon": -0.1278,
"state": "California"
}
'import requests
url = "https://api.aisa.one/apis/v1/api-ninjas/get-weather"
payload = {
"city": "London",
"country": "United States",
"lat": 51.5074,
"lon": -0.1278,
"state": "California"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
city: 'London',
country: 'United States',
lat: 51.5074,
lon: -0.1278,
state: 'California'
})
};
fetch('https://api.aisa.one/apis/v1/api-ninjas/get-weather', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/api-ninjas/get-weather",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'city' => 'London',
'country' => 'United States',
'lat' => 51.5074,
'lon' => -0.1278,
'state' => 'California'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/api-ninjas/get-weather"
payload := strings.NewReader("{\n \"city\": \"London\",\n \"country\": \"United States\",\n \"lat\": 51.5074,\n \"lon\": -0.1278,\n \"state\": \"California\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/api-ninjas/get-weather")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"city\": \"London\",\n \"country\": \"United States\",\n \"lat\": 51.5074,\n \"lon\": -0.1278,\n \"state\": \"California\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/api-ninjas/get-weather")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"city\": \"London\",\n \"country\": \"United States\",\n \"lat\": 51.5074,\n \"lon\": -0.1278,\n \"state\": \"California\"\n}"
response = http.request(request)
puts response.read_body{
"feels_like": 123,
"humidity": 123,
"max_temp": 123,
"min_temp": 123,
"sunrise": 123,
"sunset": 123,
"temp": 123,
"wind_degrees": 123,
"wind_speed": 123
}API Ninjas
Get Current Weather
Get Current Weather
POST
https://api.aisa.one
/
apis
/
v1
/
api-ninjas
/
get-weather
Get Current Weather
curl --request POST \
--url https://api.aisa.one/apis/v1/api-ninjas/get-weather \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"city": "London",
"country": "United States",
"lat": 51.5074,
"lon": -0.1278,
"state": "California"
}
'import requests
url = "https://api.aisa.one/apis/v1/api-ninjas/get-weather"
payload = {
"city": "London",
"country": "United States",
"lat": 51.5074,
"lon": -0.1278,
"state": "California"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
city: 'London',
country: 'United States',
lat: 51.5074,
lon: -0.1278,
state: 'California'
})
};
fetch('https://api.aisa.one/apis/v1/api-ninjas/get-weather', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/api-ninjas/get-weather",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'city' => 'London',
'country' => 'United States',
'lat' => 51.5074,
'lon' => -0.1278,
'state' => 'California'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/api-ninjas/get-weather"
payload := strings.NewReader("{\n \"city\": \"London\",\n \"country\": \"United States\",\n \"lat\": 51.5074,\n \"lon\": -0.1278,\n \"state\": \"California\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/api-ninjas/get-weather")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"city\": \"London\",\n \"country\": \"United States\",\n \"lat\": 51.5074,\n \"lon\": -0.1278,\n \"state\": \"California\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/api-ninjas/get-weather")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"city\": \"London\",\n \"country\": \"United States\",\n \"lat\": 51.5074,\n \"lon\": -0.1278,\n \"state\": \"California\"\n}"
response = http.request(request)
puts response.read_body{
"feels_like": 123,
"humidity": 123,
"max_temp": 123,
"min_temp": 123,
"sunrise": 123,
"sunset": 123,
"temp": 123,
"wind_degrees": 123,
"wind_speed": 123
}Request contract
- Method and path: POST /apis/v1/api-ninjas/get-weather
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/api-ninjas/get-weather
{
"operationId": "api-ninjas.get-weather",
"method": "POST",
"path": "/apis/v1/api-ninjas/get-weather",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"city": {
"description": "City name to get weather for. Must provide either city or coordinates (lat/lon).",
"examples": [
"London",
"New York",
"Tokyo"
],
"type": "string"
},
"country": {
"description": "Country name or ISO 3166-1 alpha-2 code. Use with city parameter to disambiguate locations.",
"examples": [
"United States",
"US",
"United Kingdom",
"GB"
],
"type": "string"
},
"lat": {
"description": "Latitude coordinate (-90 to 90). Must be used together with lon parameter.",
"examples": [
51.5074,
40.7128
],
"maximum": 90,
"minimum": -90,
"type": "number"
},
"lon": {
"description": "Longitude coordinate (-180 to 180). Must be used together with lat parameter.",
"examples": [
-0.1278,
-74.006
],
"maximum": 180,
"minimum": -180,
"type": "number"
},
"state": {
"description": "US state name or abbreviation (for US cities only). Use with city parameter to disambiguate locations.",
"examples": [
"California",
"CA",
"NY"
],
"type": "string"
}
},
"type": "object"
}
}
},
"required": false
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
Cost and request rules
Usage-based pricing. Default request estimate: $0.00089 USD. The final charge depends on actual usage. Your account price may differ; use a request quote where supported.Authorizations
Body
application/json