positions
:
required |
Text
number of position you want to add. |
csvfile
:
optional |
File
CSV file if variable is present in your campaign. |
curl -H "MicroworkersApiKey:YOUR_API_KEY" -X POST "https://ttv.microworkers.com/api/campaign/add_positions/B/2168e3b09815/format/json" -F "positions=10" -F "csvfile=@/var/csvfiles/sample.csv"
from pprint import pprint
from MW_API import MW_API
mw_api = MW_API('YOUR_API_KEY')
res = mw_api.do_request('POST','/campaign/add_positions/B/2168e3b09815/format/json', {"positions" : "10"}, {"csvfile" : open("/var/csvfiles/sample.csv","rb")})
pprint(res)
use MW_API;
use Data::Dumper qw(Dumper);
my $mw_api = MW_API->new('api_key' => 'YOUR_API_KEY');
my $res = $mw_api->do_request('POST', '/campaign/add_positions/B/2168e3b09815/format/json', {
"positions" => "10", "csvfile" => {"file" =>"/var/csvfiles/sample.csv"
});
print Dumper($res);
<?php
include "includes/RESTClient.php";
define("cAPI_KEY", "YOUR_API_KEY");
define("cAPI_URL", "https://ttv.microworkers.com/api");
$client = new RESTClient();
$client->setApiKey(cAPI_KEY);
$client->setUrl(cAPI_URL . "/campaign/add_positions/B/2168e3b09815/format/json");
$client->setMethod("POST");
$client->setData(array("positions" => "10", "csvfile" => new CURLFile("/var/csvfiles/sample.csv")));
$client->execute();
$response = $client->getLastResponse();
$client->resetClient();
echo $response;
?>
using System;
using MWAPI;
using System.Collections.Specialized;
public class Test{
public static void Main (string[] args){
MW_API MW_API_Client = new MW_API ("YOUR_API_KEY");
NameValueCollection postData = new NameValueCollection();
postData.Add("positions", "10");
postData.Add("csvfile", "/var/csvfiles/sample.csv");
string body = MW_API_Client.postRequest("/campaign/add_positions/B/2168e3b09815/format/json", postData);
Console.WriteLine (body);
}
}
{ "status": "SUCCESS", "response": "Positions successfully added." }
{ "status": "ERROR", "message": "Invalid CSV File." }