Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Httpservice] Error JSON??

Asked by 9 years ago

Error : Bad API request; invalid API option.

In case you forgot the API developer webpage its : http://pastebin.com/api#7

I need the script to format the data into a table and post onto my pastebin webpage.

local API='http://www.pastebin.com/api/api_post.php';
local HTTPService=game:service'HttpService';
local strf=string.format;

function pastebin_post( dev_key , user_key , paste_name , paste_code )
    local Data = {
        'api_option = \'paste\'';
        strf('api_user_key=%s',tostring(user_key));
        'api_paste_private=0';
        strf('api_paste_name=%s',HTTPService:UrlEncode( tostring(paste_name or 'Misc') ));
        'api_paste_expire_data=N';
        'api_paste_format=lua';
        strf('api_dev_key=%s',tostring(dev_key));
        strf('api_paste_code=%s',HTTPService:UrlEncode( tostring(paste_code) ));
    };
    Data = table.concat(Data,'&');
    print(Data)
    local Result = HTTPService:PostAsync(API,Data,2);
    print('Results: '..Result);
    return(Result);
end;

local Reason = "Testing Pastebin postasync from ROBLOX"
local Plr = "derp"

pastebin_post( 
    '' , -- For security reason's this key has been removed before this post. 
    'jillmiles1' , 
    'Actinium-Banlist' , 
    "{"..Plr..", -1 , "..Reason..",'Really red'}"
)

Answer this question