Available Methods

Here are listed all the methods that our API provides.
Every method is correlated with an example request and response, also with the parameters that method requires.

createPoll

Use this method to create a new poll.
This method return a Poll type.

Required parameters:
title (String, 1-512 characters)

This is the title of your new poll.

type (String, 1-64 characters)

This is the type of your new poll.

privacy (String, 1-32 characters)

This is the privacy option of your new poll. (anonymous or personal)

choices (Array)

Required for the vote, doodle, limited doodle and quiz poll types. There are the vote options.

max_choices (Integer)

Required for the limited doodle poll type. There are the maximum number of options that a user can vote on.

right_choices (Array)

Required for the quiz poll type. There are the right vote options.

start_rating_range (Integer, 1-9 numbers)

Required for the rating poll type. This is the start integer of your rating poll.

end_rating_range (Integer, 2-10 numbers)

Required for the rating poll type. This is the end integer of your rating poll.

Optional parameters:
description (String, 1-512 characters)

This is the description of your new poll.

settings (Array)

There are the settings of your new poll. View the Settings type.

Request:
$ curl https://api.masterpoll.xyz/user<token>/createPoll?title=Test API&description=Successfully&type=participation&privacy=personal

Response:


{
  “ok”: true,
  “result”: {
    “poll_id”: 7,
    “owner_id”: 1518134459,
    “title”: “Test API”,
    “description”: “Successfully”,
    “privacy”: “personal”,
    “type”: “participation”,
    “participants”: []
  }
}

editPoll

Use this method to edit a poll.
This method return the Settings field edited successfully.

Required parameters:
id (Integer)

Identifier of the poll, you can find them on the list command.

privacy (String 1-32 characters)

This is the privacy option of your poll. (Anonymous or personal)

settings (Array)

Array of options to edit on the poll. View the Settings type.

Request:
$ curl https://api.masterpoll.xyz/user<token>/editPoll?id=1&settings=[“disable_web_page_preview”:true]

Response:


{
  “ok”: true,
  “result”: {
    “disable_web_page_preview”: true
  }
}

deletePoll

Use this method to delete a poll.

This action is irreversible.

Required parameter:
id (Integer)

Identifier of the poll, you can find them on the list command.

Request:
$ curl https://api.masterpoll.xyz/user<token>/deletePoll?id=3

Response:


{
  “ok”: true,
  “result”: true
}

addVote

Use this method to vote in a poll.

Required parameter:
id (Integer)

Identifier of the poll, you can find them on the list command.

choice (String, 1-128 characters)

Required for the vote, doodle, limited doodle and quiz poll types. This is the vote option.

comment (String, 1-128 characters)

Required for the board poll type. This is the comment on the board.

rate (Integer 1-10 numbers)

Required for the rating poll type. This is the rating.

Optional parameters:
owner_id (Integer)

ID of the poll creator. You can add votes only to polls created by the owner of the token that you’re using.

Note: The partecipation poll types doesn’t require any parameter.
If a poll is a partecipation, simply pass the poll id

Request:
$ curl https://api.masterpoll.xyz/user<token>/addVote?id=3&choice=Testing

Response:


{
  “ok”: true,
  “result”: true
}

editVote

Use this method to change the vote in a poll.

Required parameter:
id (Integer)

Identifier of the poll, you can find them on the list command.

owner_id (Integer)

ID of the poll creator. You can edit votes only to polls created by the owner of the token that you’re using.

choice (String, 1-128 characters)

Required for the vote and quiz poll types. This is the vote option.

comment (String, 1-128 characters)

Required for the board poll type. This is the comment on the board.

rate (Integer 1-10 numbers)

Required for the rating poll type. This is the rating.

participate (Boolean)

Required for the participation poll type.

Request:
$ curl https://api.masterpoll.xyz/user<token>/editVote?id=3&choice=Testing

Response:


{
  “ok”: true,
  “result”: true
}

removeVote

Use this method to remove vote in a poll.

This action is irreversible.

Required parameter:
id (Integer)

Identifier of the poll, you can find them on the list command.

choice (String, 1-128 characters)

Required for the doodle, limited doodle and quiz poll types. There are the vote options.

Optional parameters:
owner_id (Integer)

ID of the poll creator. You can remove votes only to polls created by the owner of the token that you’re using.

Note: The other poll types doesn’t require any parameter.
If is a poll type that isn’t listed above, simply pass the poll id

Request:
$ curl https://api.masterpoll.xyz/user<token>/removeVote?id=3&choice=Testing

Response:


{
  “ok”: true,
  “result”: true
}

getPoll

Use this method to get data from a specific poll.
This method return a Poll type.

Required parameter:
id (Integer)

Identifier of the poll, you can find them on the list command.

Optional parameters:
owner_id (Integer)

ID of the poll creator. You can only get polls created by the owner of the token that you’re using.

Request:
$ curl https://api.masterpoll.xyz/user<token>/getPoll?id=1

Response:


{
  “ok”: true,
  “result”: {
    “poll_id”: 1,
    “owner_id”: 836296867,
    “title”: “Test Vote”,
    “privacy”: “anonymous”,
    “type”: “vote”,
    “choices”: {
      “Test”: 8,
      “Beep Boop”: 7
    }
  }
}

getActivePolls

Use this method to get all opened polls you have created with our Bots.
This method return an array of Poll type.

Request:
$ curl https://api.masterpoll.xyz/user<token>/getActivePolls

Response:


{
  “ok”: true,
  “result”: [
    {
      “poll_id”: 1,
      “owner_id”: 836296867,
      “title”: “Test Vote”,
      “privacy”: “anonymous”,
      “type”: “vote”,
      “choices”: {
        “Test”: 8,
        “Beep Boop”: 7
      }
    },
    {
      “poll_id”: 2,
      “owner_id”: 836296867,
      “title”: “Another Test Vote”,
      “description”: “Yes, i’m just a test”,
      “privacy”: “personal”,
      “type”: “vote”,
      “choices”: {
        “1”: [
          “TestUser”
        ],
        “2”: [
          “The system”
  ]
      }
    },
    {
      “poll_id”: 3,
      “owner_id”: 836296867,
      “title”: “I’m on api example!”,
      “privacy”: “anonymous”,
      “type”: “board”,
      “comments”: [
        “What is an api?”,
        “API for MasterPoll?? WOW”
      ]
    }
  ]
}

getAllPolls

Use this method to get a list of all polls you have created with our Bots.
This method return an array of Poll type.

Request:
$ curl https://api.masterpoll.xyz/user<token>/getAllPolls

Response:


{
  “ok”: true,
  “result”: [
    {
      “poll_id”: 1,
      “owner_id”: 836296867,
      “title”: “Test Vote”,
      “privacy”: “anonymous”,
      “type”: “vote”,
      “choices”: {
        “Test”: 8,
        “Beep Boop”: 7
      }
    },
    {
      “poll_id”: 2,
      “owner_id”: 836296867,
      “title”: “Another Test Vote”,
      “description”: “Yes, i’m just a test”,
      “privacy”: “personal”,
      “type”: “vote”,
      “choices”: {
        “1”: [
          “TestUser”
        ],
        “2”: [
          “The system”
    ]
      }
    },
    {
      “poll_id”: 3,
      “owner_id”: 836296867,
      “title”: “I’m on api example!”,
      “privacy”: “anonymous”,
      “type”: “board”,
      “comments”: [
        “What is an api?”,
        “API for MasterPoll?? WOW”
      ]
    }
  ]
}

openPoll

Use this method for open a closed poll.

Required parameter:
id (Integer)

Identifier of the poll, you can find them on the list command.

Request:
$ curl https://api.masterpoll.xyz/user<token>/openPoll?id=3

Response:


{
  “ok”: true,
  “result”: true
}

closePoll

Use this method for close a opened poll.

Required parameter:
id (Integer)

Identifier of the poll, you can find them on the list command.

Request:
$ curl https://api.masterpoll.xyz/user<token>/closePoll?id=3

Response:


{
  “ok”: true,
  “result”: true
}

getMe

Use this method to get your Telegram’s data from our database.

Request:
$ curl https://api.masterpoll.xyz/user<token>/getMe

Response:


{
  “ok”: true,
  “result”: {
    “id”: 421575154,
    “first_name”: “TestUser,
    “last_name”: “This is the Surname”,
    “username”: “ICantHaveThisUsernameOnTelegram”,
    “language_code”: “en”
  }
}

getSubscribers

Use this method to get the number of the registered users in our database.

Request:
$ curl https://api.masterpoll.xyz/user<token>/getSubscribers

Response:


{
  “ok”: true,
  “result”: 999999
}

graph

Use this method to get the progress of your poll as a graph
This method return a String with the url of the graph image uploaded to the Telegra.ph’s servers.
This method work only with this type of polls:

  • vote
  • doodle
  • limited doodle
  • rating
  • quiz

Required parameters:
id (Integer)

Identifier of the poll, you can find them on the list command.

type (String)

The type of graph to render. Pass as parameter bar to get a bar graph or pass pie to get a pie graph.

Optional parameters:
theme (String)

The type of theme to render. Pass as parameter dark to get a dark themed graph or pass light to get the light one.

Request:
$ curl https://api.masterpoll.xyz/user<token>/graph?id=3&type=pie&theme=dark

Response:


{
  “ok”: true,
  “result”: “https://telegra.ph/file/991af0a6e5f8a5471cd06.png”
}

status

Use this method to get the API service status.

Request:
$ curl https://api.masterpoll.xyz/status

Response:


{
  “ok”: true,
  “result”: true,
  “monitor_url”: “https://uptime.masterpoll.xyz”
}