Question about httpsservice

Hello, so, About HttpsService, I’ve been curious so for example, is there a way to for example… print the name of a role of an Discord user? does with HttpsService you can get URL’s as YouTube? Roblox? Anything you want? or it need’s to be an API like this one: here ?

So, httpsservice can go trough any URL? Like discord youtube? or it needs to be an API?
If so, then how would I print a person rank in Discord for example! This is just a question so yeah! thanks.

To understand how HttpService works, you have to understand first that HTTP is a request between the client and server. The server can be requested to do Things and they will normally output a response, or change something. You could use these two methods in Roblox to communicate with other servers.

You could explore all the methods you can use with it here. - HttpService | Documentation - Roblox Creator Hub

POST

This posts a JSON table to a site, for this to work you have to have a server set up and code that interpret POST requests.

GET

This returns information based on the website, this is useful if you have something you want your users to see and it’s easy to change without going through studio.


I haven’t done what you are trying to achieve now, but I think you might be able to do this by creating a discord Bot and getting the players roles with it and then communicate with the bot to get the person’s roles and print it.

So, for example, YouTube? Is locked or something like that? As you can’t create a bot for YouTube I suppose? Let’s suppose I want to print the 1st trending video? I jsondecode the url and get async? but how I get the response, what I’m searching for? I think you know what I mean

You can’t just use the GET method on any Url, but Google provides you with some API for developers. You could explore the one you are searching for here maybe - Search: list  |  YouTube Data API  |  Google for Developers

Hey, HttpService does regular Http Routing and requests. Any website you go to can technically count as an API requests. For example whenever you visit a website (like the devforum) you’re sending a GET request to the server to return information to display on the client (your web browser) HttpService does things similar to that. You can use GETAsync and POSTAsync to send Get and Post requests to roblox.

In order to get the time with world clock you would send a GET Request to the api endpoint

local Http = game:GetService('HttpService')

local success, message = pcall(function()
     local unDecodedResponse = Http:GetAsync('http://worldclockapi.com/api/json/utc/now') -- After sending a get request it will send back the BODY in JSON however, we need to decode that into a readable LUA table format.
     local response = Http:JSONDecode(unDecodedResponse);
     --[[ Response:
     {
  "$id": "1",
  "currentDateTime": "2020-02-16T03:18Z",
  "utcOffset": "00:00:00",
  "isDayLightSavingsTime": false,
  "dayOfTheWeek": "Sunday",
  "timeZoneName": "UTC",
  "currentFileTime": 132262967252045457,
  "ordinalDate": "2020-47",
  "serviceResponse": null
}
--]]
print(response.currentDateTime) -- 2020-02-16T03:18Z
end)

if not success then
    -- Handle error with httpservice
   print('error: ' .. message)
end

For a lot more in-depth explanation read here: PANDORA188: Situs Slot Online Gacor Terpercaya 88 Besar

1 Like

Youtube does infact have an open sourced API and documentation for that. They just don’t have it very easy to find. If you go to YouTube Data API  |  Google Developers you are able to find Google’s API for Youtube.

If you go to https://console.developers.google.com/ and create a project you can very simply get access to youtube’s API


image

1 Like