Quote revision
POST https://{userId}:{token}@api.voicebunny.com/reads/{ID}/revision/quote
Description
Find out the price for your revision based on a previously submitted read. Revisions are free if there are no major changes to the script, otherwise, you'll just pay for the words or characters that changed.
Arguments
= required = only one of these is requiredName | Type | Description | Default value |
---|---|---|---|
charactersToBeRecorded | integer | The number of characters that need to be added or re-recorded. Use this argument only if the language of the project is character based. | |
wordsToBeRecorded | integer | The number of words that need to be added or re-recorded. Use this argument only if the language of the project is word based. | |
changingScript | boolean | Set this argument to "1" if you are changing the script. When set to "0", the revision is free of charge. | 0 |
Errors
- 5018: The ID in the url makes reference to a deliverable that does not exist.
- 5082: The value of the argument "wordsToBeRecorded" should be a positive integer.
- 5083: The pricing for this language is based on the number of characters. Please use the argument "charactersToBeRecorded" instead. The value of the argument "wordsToBeRecorded" should be null.
- 5084: The value of the argument "charactersToBeRecorded" should be a positive integer.
- 5085: The pricing for this language is based on the number of words. Please use the argument "wordsToBeRecorded" instead. The value of the argument "charactersToBeRecorded" should be null.
- 5087: The argument "changingInstructions" should be 1 or 0. If "0", you won't pay for this revision. If "1" you'll pay for this revision.
Code example
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.2' )
import groovyx.net.http.*
import groovy.json.*
import static groovyx.net.http.ContentType.*
import static groovyx.net.http.Method.*
http = new HTTPBuilder('https://api.voicebunny.com')
http.handler.success = {response, json -> return json}
http.handler.failure = {response, json -> throw new RuntimeException(json.error.code + ' ' + json.error.message)}
def voicebunnyUser = 'xxXXxx'
def voicebunnyToken = 'xxxxXXXXxxxxXXXX'
http.auth.basic voicebunnyUser, voicebunnyToken
def data = [
wordsToBeRecorded: 1,
voiceBunnyError: 1
]
def quote = http.post(path: '/reads/1/revision/quote', body: data, requestContentType: URLENC)
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.Map.Entry;
import org.apache.commons.codec.binary.Base64;
public class Voicebunny {
private String user = "xxXXxx";
private String token = "xxxxXXXXxxxxXXXX";
private String encodedAuthorization = "";
private String host = "https://api.voicebunny.com";
public Voicebunny() {
String userpassword = user + ":" + token;
encodedAuthorization = Base64.encodeBase64String(userpassword.getBytes());
}
public static void main(String[] args) throws IOException {
Voicebunny vb = new Voicebunny();
System.out.println(vb.quoteProject());
}
private String quoteProject() throws UnsupportedEncodingException, MalformedURLException, ProtocolException, IOException {
Map<String, String> params = new HashMap<String, String>();
params.put("wordsAddedOrChanged", "1");
params.put("voiceBunnyError", "1");
return post("/reads/1/revision/quote", params);
}
private String post(String resource, Map<String, String> params) throws UnsupportedEncodingException, MalformedURLException, IOException, ProtocolException {
String data = "";
for (Entry<String, String> entry : params.entrySet()) {
if (!data.isEmpty()) {
data += "&";
}
data += (URLEncoder.encode(entry.getKey(), "UTF-8") + "=" + URLEncoder.encode(entry.getValue(), "UTF-8"));
}
URL url = new URL(host + "/" + resource);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Authorization", "Basic " + encodedAuthorization);
connection.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream());
wr.write(data);
wr.flush();
InputStream in = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuffer sb = new StringBuffer();
String line = "";
while ((line = reader.readLine()) != null) {
sb.append(line);
}
wr.close();
reader.close();
return sb.toString();
}
}
<?php
$url_api = 'https://api.voicebunny.com/reads/1/revision/quote';
$postVars = array(
'wordsToBeRecorded'=>'1',
'voiceBunnyError'=>'1'
);
$vars = http_build_query($postVars);
$opts = array(
CURLOPT_URL => $url_api,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_INFILESIZE => -1,
CURLOPT_TIMEOUT => 60,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => $vars,
);
$curl = curl_init();
curl_setopt_array($curl, $opts);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
print_r($response);
?>
import requests
import simplejson
from requests.auth import HTTPBasicAuth
url = 'https://api.voicebunny.com'
api_id = 'XX'
api_key = "xxxxXXXXxxxxXXXX"
req = requests.get(url+'/reads/1/revision/quote',
data={'voiceBunnyError': '1',
'wordsToBeRecorded': '1'},
auth=HTTPBasicAuth(api_id, api_key),verify=False)
data = simplejson.loads(req.text)
response = data['quote']
require 'faraday'
require 'faraday_middleware'
@conn = nil
@api_id = "XX"
@api_key = "xxxxXXXXxxxxXXXX"
resp = nil
@conn = Faraday.new(:url =>("https://"+ @api_id+":"+@api_key +"@api.voicebunny.com"),:ssl => {:verify => false}) do |builder|
builder.use Faraday::Request::Multipart
builder.use Faraday::Request::UrlEncoded
builder.use Faraday::Response::ParseJson
builder.use Faraday::Adapter::NetHttp
end
end
resp = @conn.post '/reads/1/revision/quote', {
wordsToBeRecorded: '1',
voiceBunnyError: '1'
}
resp.body
