I highly doubt this still works, as ROBLOX has surely changed their APIs since 20(14?). I'll leave this up as a testament to how you SHOULDN'T develop a wrapper for a Web API.
C# API for performing automated tasks on ROBLOX.com
- Login to get authentication cookies / tokens
- Check messages and automate responses
- Monitor trades and build trade responses / requests
- Automatically purchase assets
CookieContainer collection;
RobloxLogin login = new RobloxLogin("HomeguardDev", "hunter2", out collection);
String authCookies = login.authCookies;
The rest of the examples here will assume that you have already logged in and have authCookies stored
RobloxTradeHandler tradeHandler = new RobloxTradeHandler();
String XRSFToken = RobloxUtils.getXSRFToken(login.authCookies);
TradeList list = tradeHandler.fetchTrades(login.authCookies, XRSFToken, TradeType.Inbound, 0);
foreach (TradeSession tradeSession in list.Data)
{
TradeDetailsData info = tradeHandler.getTradeInfo(tradeSession.TradeSessionID, XRSFToken, login.authCookies).data;
Debug.WriteLine(RobloxUtils.getUsername(tradeSession.TradePartnerID).Username + " has an inbound trade with you!");
TradeObject trade = RobloxUtils.makeTradeObject(info);
Debug.WriteLine("They are offering:");
foreach (InventoryItem item in trade.receiving.OfferList)
{
Debug.WriteLine("\t" + item.Name);
}
Debug.WriteLine("For your: ");
foreach (InventoryItem item in trade.sending.OfferList)
{
Debug.WriteLine("\t" + item.Name);
}
}
int myId = RobloxUtils.getUserId("HomeguardDev").Id;
foreach (TradeSession tradeSession in list.Data)
{
TradeDetailsData info = tradeHandler.getTradeInfo(tradeSession.TradeSessionID, XRSFToken, login.authCookies).data;
Debug.WriteLine(RobloxUtils.getUsername(tradeSession.TradePartnerID).Username + " has an inbound trade with you!");
TradeObject trade = RobloxUtils.makeTradeObject(info);
if (trade.receiving.OfferValue > trade.sending.OfferValue) //accepts all trades where the receiving RAP is higher then your RAP
{
String json = tradeHandler.createTradeRequest(myId + "", tradeSession.TradePartnerID, trade);
tradeHandler.sendTrade(TradeResponseType.Accept, json, XRSFToken, tradeSession.TradeSessionID, login.authCookies);
}
}
RobloxMessageHandler messageHandler = new RobloxMessageHandler();
String XRSFToken = RobloxUtils.getXSRFToken(login.authCookies);
MessageCollection messages = messageHandler.getNewMessages("0", login.authCookies);
foreach (Message message in messages.Collection)
{
Debug.WriteLine(message.Sender.UserName + "->" + message.Recipient.UserName + "\n" + message.Body);
}
RobloxMessageHandler messageHandler = new RobloxMessageHandler();
messageHandler.sendMessage(7904, "Hey Me!", "What's up?", login.authCookies);
RobloxPurchaseHandler purchase = new RobloxPurchaseHandler();
bool response = purchase.requestLimitedPurchase(1337, 123, 1000, login.authCookies); //1337 is assetID, 123 is userAssetOptionId, and 1000 is the price
Debug.WriteLine(response);
RobloxPurchaseHandler purchase = new RobloxPurchaseHandler();
bool response = purchase.requestAssetPurchase(20642008, 40, CurrencyType.ROBUX, login.authCookies);
Debug.WriteLine(response);