Skip to main content

Basic

URL: https://api.elmasy.com/

Read errors first: https://wiki.danielgorbe.com/books/api/page/api#bkmrk-error


Ping

HTTP Request

GET https://api.elmasy.com/ping

Response

{"message":"pong"}

Error

This endpoint can't fail.

Example

$ curl 'https://api.elmasy.com/ping'
{"message":"pong"}

Get your public IP address

This endpoint returns your public IP address.

HTTP Request

GET https://api.elmasy.com/ip

Response

A string of your public IP address.

Error

This endpoint can't fail.

Example

$ curl https://api.elmasy.com/ip
X.X.X.X

Get a random public IP address

This endpoint returns a random public IPv4/IPv6 address.

HTTP Request

GET https://api.elmasy.com/randomip/:version

URL Parameters

Parameter Required Description
version Yes The IP protocol version. Possible values are ipv4 or ipv6.

Response

{
  "ip": "X.X.X.X"
}

Error

This endpoint can't fail.

Example

$ curl 'https://api.elmasy.com/randomip/ipv4'
{"ip":"X.X.X.X"}

DNS query

This endpoint do a DNS query.

HTTP Request

GET https://api.elmasy.com/protocol/dns/:type/:name

URL Parameters

Parameter Required Description
type Yes The record type. Currently implemented types: A, AAAA, MX, TXT.
name Yes The name of the resource record that is to be looked up

Response

A string array containing the answer section.

In case of MX, the preference (priority) numbers are omitted, but the array is sorted based on it.

{
  "answer": [
    "...",
    "..."
  ]
}

Error

 

Example

$ curl 'https://api.elmasy.com/protocol/dns/A/api.elmasy.com'
{"answer":["X.X.X.X"]}

Error

In case of error, HTTP response status code is set according to the error.

The body always has the same format: {"error":"..."}, where error describe the reason of the status code.

Example

$ curl 'https://api.elmasy.com/randomip/ipv5'
{"error":"Invalid version: ipv5"}