Viktor Jaep
Part of the Furniture
FULL DISCLOSURE: I absolutely SUCK at JQuery... It's not like SQL at all, which I'm pretty decent with. I think the reason I am no good at this is because the sources this data comes from is always structured very differently in JSON, so there's always a completely different way at getting at the data. If you find a better way of doing something, please feel free to post it and/or correct me.
Current VPN Providers Supported that utilize an API functionality:
This discussion below was created to provide more examples of how CURL + JQ statements can be used to auto-populate custom VPN Server Lists within VPNMON-R3. For instance, you may want your VPN Client Slot 1 to only connect to servers in New York City. VPN Slot 2 might be populated with all the servers within Canada. Etc. I'm providing examples of what might be possible, and how to craft these statements so you can copy/paste them directly into VPNMON-R3 with minimal effort.
As shown below, the "VPN Client Slot Server List Automation" menu allows you to View/Edit and Execute these statements, which will then pull the required VPN Server IPs from these various VPN Providers, and copy them into local server lists that VPNMON-R3 uses to reconnect your connections to.
NordVPN - API has been deprecated
NOTE: It seems that some API URLs continue to work as of Mar 5 2024, but that doesn't mean they will continue working as time goes on. Please plan for the worst that these will all be deprecated at some point: https://support.nordvpn.com/hc/en-u...uation-of-the-legacy-API-endpoints-on-NordVPN
1) All NordVPN Servers in a certain City: In this example, I will show you how to filter all VPN Servers for a certain city... copy and paste the curl statements into an SSH window on your router to test their output.
First, determine a list of all valid countries, along with available city names within that country (Exact spelling is of great importance!)
Once you have found your country/city in the list, replace the city name (exact spelling) in the curl statement below. In this example, I'm using "New York". If the output creates a single list of IP addresses, you can copy/paste this statement into your VPNMON-R3 Server List Automation Slot, and execute it in order to generate a list.
2) All NordVPN Servers in a certain Country: This example shows you how to export all VPN Server IPs for a certain country... copy and paste the curl statements into an SSH window on your router to test their output.
First, determine the name for your country of choice. (Exact spelling is of great importance!)
Once you have found your country name, replace the name in the curl statement below. In this example, I'm using "United States". If the output creates a single list of IP addresses, you can copy/paste this statement into your VPNMON-R3 Server List Automation Slot, and execute it in order to generate a list.
3) Top 5 Recommended NordVPN Servers: This example shows you how to export all recommended NordVPN Server IPs that is based on a NordVPN algorithm per your location, and should be the fastest with the lowest load ... copy and paste the curl statements into an SSH window on your router to test their output.
First, determine the ID for your country of choice. (Exact number is of great importance!). The ID is in [ ] directly next to your country name.
Once you have found your Country ID, replace the ID in the curl statement below. In this example, I'm using United States, which is ID 228. If the output creates a single list of IP addresses, you can copy/paste this statement into your VPNMON-R3 Server List Automation Slot, and execute it in order to generate a list.
...knowing what you learned above:
4) All NordVPN servers within the US that support OpenVPN UDP protocols
5.) All servers within New York City that support OpenVPN UDP protocols
Here's a list of the technologies/IDs in case you're looking for something other than UDP:
Code:
"technologies": [
{
"id": 1,
"name": "IKEv2/IPSec",
"identifier": "ikev2",
},
{
"id": 3,
"name": "OpenVPN UDP",
"identifier": "openvpn_udp",
},
{
"id": 5,
"name": "OpenVPN TCP",
"identifier": "openvpn_tcp",
},
{
"id": 21,
"name": "HTTP Proxy (SSL)",
"identifier": "proxy_ssl",
},
{
"id": 23,
"name": "HTTP CyberSec Proxy (SSL)",
"identifier": "proxy_ssl_cybersec",
},
{
"id": 35,
"name": "Wireguard",
"identifier": "wireguard_udp",
}
NOTE: Being a bit biased and a user myself, NordVPN probably has one of the best developed API's to pull data, though it's not officially documented. Here's a GREAT site that goes into very great detail how you can run various CURL/JQ statements to get some very specific info using the API: https://sleeplessbeastie.eu/2019/02/18/how-to-use-public-nordvpn-api/
AirVPN
1) All AirVPN Servers in a certain City: This example shows you how to export all VPN Server IPs for a certain city... copy and paste the curl statements into an SSH window on your router to test their output.
First, determine the name for your City of choice. (Exact spelling is of great importance!)
Once you have found your City name, replace the name in the curl statement below. In this example, I'm using "New York City". If the output creates a single list of IP addresses, you can copy/paste this statement into your VPNMON-R3 Server List Automation Slot, and execute it in order to generate a list.
2) All AirVPN Servers in a certain Country: This example shows you how to export all VPN Server IPs for a certain country... copy and paste the curl statements into an SSH window on your router to test their output.
First, determine the name for your country of choice. (Exact spelling is of great importance!)
Once you have found your country name, replace the name in the curl statement below. In this example, I'm using "United States". If the output creates a single list of IP addresses, you can copy/paste this statement into your VPNMON-R3 Server List Automation Slot, and execute it in order to generate a list.
Current VPN Providers Supported that utilize an API functionality:
- NordVPN
- AirVPN
- PerfectPrivacy
- SurfShark
- ProtonVPN
- PIA
This discussion below was created to provide more examples of how CURL + JQ statements can be used to auto-populate custom VPN Server Lists within VPNMON-R3. For instance, you may want your VPN Client Slot 1 to only connect to servers in New York City. VPN Slot 2 might be populated with all the servers within Canada. Etc. I'm providing examples of what might be possible, and how to craft these statements so you can copy/paste them directly into VPNMON-R3 with minimal effort.
As shown below, the "VPN Client Slot Server List Automation" menu allows you to View/Edit and Execute these statements, which will then pull the required VPN Server IPs from these various VPN Providers, and copy them into local server lists that VPNMON-R3 uses to reconnect your connections to.
NordVPN - API has been deprecated
NOTE: It seems that some API URLs continue to work as of Mar 5 2024, but that doesn't mean they will continue working as time goes on. Please plan for the worst that these will all be deprecated at some point: https://support.nordvpn.com/hc/en-u...uation-of-the-legacy-API-endpoints-on-NordVPN
1) All NordVPN Servers in a certain City: In this example, I will show you how to filter all VPN Servers for a certain city... copy and paste the curl statements into an SSH window on your router to test their output.
First, determine a list of all valid countries, along with available city names within that country (Exact spelling is of great importance!)
Code:
curl --silent "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | . as $parent | .cities[] | [$parent.name, $parent.id, .name, .id] | "\(.[0]) [\(.[1])] - \(.[2]) [\(.[3])]"'
Once you have found your country/city in the list, replace the city name (exact spelling) in the curl statement below. In this example, I'm using "New York". If the output creates a single list of IP addresses, you can copy/paste this statement into your VPNMON-R3 Server List Automation Slot, and execute it in order to generate a list.
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors https://api.nordvpn.com/v1/servers?limit=16354 | jq --raw-output '.[] | select(.locations[0].country.city.name == "New York") | .station'
2) All NordVPN Servers in a certain Country: This example shows you how to export all VPN Server IPs for a certain country... copy and paste the curl statements into an SSH window on your router to test their output.
First, determine the name for your country of choice. (Exact spelling is of great importance!)
Code:
curl --silent "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | . as $parent | .cities[] | [$parent.name, $parent.id, .name, .id] | "\(.[0]) [\(.[1])] - \(.[2]) [\(.[3])]"'
Once you have found your country name, replace the name in the curl statement below. In this example, I'm using "United States". If the output creates a single list of IP addresses, you can copy/paste this statement into your VPNMON-R3 Server List Automation Slot, and execute it in order to generate a list.
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors https://api.nordvpn.com/v1/servers?limit=16354 | jq --raw-output '.[] | select(.locations[0].country.name == "United States") | .station''
3) Top 5 Recommended NordVPN Servers: This example shows you how to export all recommended NordVPN Server IPs that is based on a NordVPN algorithm per your location, and should be the fastest with the lowest load ... copy and paste the curl statements into an SSH window on your router to test their output.
First, determine the ID for your country of choice. (Exact number is of great importance!). The ID is in [ ] directly next to your country name.
Code:
curl --silent "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | . as $parent | .cities[] | [$parent.name, $parent.id, .name, .id] | "\(.[0]) [\(.[1])] - \(.[2]) [\(.[3])]"'
Once you have found your Country ID, replace the ID in the curl statement below. In this example, I'm using United States, which is ID 228. If the output creates a single list of IP addresses, you can copy/paste this statement into your VPNMON-R3 Server List Automation Slot, and execute it in order to generate a list.
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors "https://api.nordvpn.com/v1/servers/recommendations?filters\[country_id\]=228&limit=5" | jq --raw-output '.[].station'
...knowing what you learned above:
4) All NordVPN servers within the US that support OpenVPN UDP protocols
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors https://api.nordvpn.com/v1/servers?limit=16354 | jq --raw-output '.[] | select((.locations[0].country.name == "United States") and (.technologies[0].id = 3)) | .station'
5.) All servers within New York City that support OpenVPN UDP protocols
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors https://api.nordvpn.com/v1/servers?limit=16354 | jq --raw-output '.[] | select((.locations[0].country.city.name == "New York") and (.technologies[0].id = 3)) | .station'
Here's a list of the technologies/IDs in case you're looking for something other than UDP:
Code:
"technologies": [
{
"id": 1,
"name": "IKEv2/IPSec",
"identifier": "ikev2",
},
{
"id": 3,
"name": "OpenVPN UDP",
"identifier": "openvpn_udp",
},
{
"id": 5,
"name": "OpenVPN TCP",
"identifier": "openvpn_tcp",
},
{
"id": 21,
"name": "HTTP Proxy (SSL)",
"identifier": "proxy_ssl",
},
{
"id": 23,
"name": "HTTP CyberSec Proxy (SSL)",
"identifier": "proxy_ssl_cybersec",
},
{
"id": 35,
"name": "Wireguard",
"identifier": "wireguard_udp",
}
NOTE: Being a bit biased and a user myself, NordVPN probably has one of the best developed API's to pull data, though it's not officially documented. Here's a GREAT site that goes into very great detail how you can run various CURL/JQ statements to get some very specific info using the API: https://sleeplessbeastie.eu/2019/02/18/how-to-use-public-nordvpn-api/
AirVPN
1) All AirVPN Servers in a certain City: This example shows you how to export all VPN Server IPs for a certain city... copy and paste the curl statements into an SSH window on your router to test their output.
First, determine the name for your City of choice. (Exact spelling is of great importance!)
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors https://airvpn.org/api/status/ | jq --raw-output '.servers | group_by(.location) | map(.[0].location)'
Once you have found your City name, replace the name in the curl statement below. In this example, I'm using "New York City". If the output creates a single list of IP addresses, you can copy/paste this statement into your VPNMON-R3 Server List Automation Slot, and execute it in order to generate a list.
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors https://airvpn.org/api/status/ | jq --raw-output '.servers[] | select(.location=="New York City") | .ip_v4_in3, .ip_v4_in4'
2) All AirVPN Servers in a certain Country: This example shows you how to export all VPN Server IPs for a certain country... copy and paste the curl statements into an SSH window on your router to test their output.
First, determine the name for your country of choice. (Exact spelling is of great importance!)
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors https://airvpn.org/api/status/ | jq --raw-output '.servers | group_by(.country_name) | map(.[0].country_name)'
Once you have found your country name, replace the name in the curl statement below. In this example, I'm using "United States". If the output creates a single list of IP addresses, you can copy/paste this statement into your VPNMON-R3 Server List Automation Slot, and execute it in order to generate a list.
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors https://airvpn.org/api/status/ | jq --raw-output '.servers[] | select(.country_name=="United States") | .ip_v4_in3, .ip_v4_in4'
Last edited: