curl --request POST \
--url https://ruangapi.com/api/v1/shopee \
--header 'accept: application/json' \
--header 'authorization: your-api-key' \
--data 'username=ngelapakid&take=10'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://ruangapi.com/api/v1/shopee",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "username=ngelapakid&take=10",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: your-api-key"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var unirest = require("unirest");
var req = unirest("POST", "https://ruangapi.com/api/v1/shopee");
req.headers({
"authorization": "your-api-key",
"accept": "application/json"
});
req.send("username=ngelapakid&take=10");
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
HttpResponse<String> response = Unirest.post("https://ruangapi.com/api/v1/shopee")
.header("authorization", "your-api-key")
.header("accept", "application/json")
.body("username=ngelapakid&take=10")
.asString();
import requests
url = "https://ruangapi.com/api/v1/shopee"
payload = "username=ngelapakid&take=10"
headers = {
'authorization': "your-api-key",
'accept': "application/json"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://ruangapi.com/api/v1/shopee")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["authorization"] = 'your-api-key'
request["accept"] = 'application/json'
request.body = "username=ngelapakid&take=10"
response = http.request(request)
puts response.read_body
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"authorization": @"your-api-key",
@"accept": @"application/json" };
NSData *postData = [[NSData alloc] initWithData:[@"username=ngelapakid&take=10" dataUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://ruangapi.com/api/v1/shopee"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://ruangapi.com/api/v1/shopee"
payload := strings.NewReader("username=ngelapakid&take=10")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "your-api-key")
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}