Crédits voix
- Home
- Crédits voix
Crédits voix
Cette requête est utilisée pour récupérer votre crédit disponible de messages vocaux, dépôt de messages.
Limite: 5 requêtes par minute
URL
GET https://api.voicepartner.fr/v1/me
Paramètres
Chaque demande d’API prend en charge les paramètres suivants :
apiKey | Clé API de votre compte. Vous l’obtenez dans votre compte Voice Partner |
---|---|
Paramètres optionnels | |
_format | Format de la réponse. Vous pouvez choisir entre json ou xml. Par défaut, le format de réponse est JSON. |
Requête
Exemple de requête:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?php // Prepare data for GET request $data = 'YOUR_API_KEY'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL,'https://api.voicepartner.fr/v1/me/'.$data); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_TIMEOUT, 10); $result = curl_exec($curl); curl_close($curl); // Process your response here echo $result; ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
cURL Imports System.IO Imports System.Net Module Module1 Sub Main() Dim base_url As String = "https://api.voicepartner.fr/v1/" Dim apiKey As String = "VOTRE_APIKEY" #check credits Dim url As String url = base_url & "me" & "/" & apiKey Dim credits As String credits = apiRequest("GET", url, Nothing) End Sub Function apiRequest(method As String, url As String, parameters As String) As String Dim request As HttpWebRequest request = WebRequest.Create(url) request.Method = method request.Timeout = 10000 # timeout in ms request.ContentType = "application/json; charset=utf-8" request.ContentLength = 0 #set POST data If Not String.IsNullOrEmpty(parameters) Then request.ContentLength = parameters.Length Using reqStream As StreamWriter = New StreamWriter(request.GetRequestStream()) reqStream.Write(parameters) End Using End If #get response Dim returnValue As String = Nothing Using response As HttpWebResponse = request.GetResponse() If response.StatusCode = HttpStatusCode.OK Then Using resStream = response.GetResponseStream() If resStream IsNot Nothing Then Using reader As New StreamReader(resStream) returnValue = reader.ReadToEnd() End Using End If End Using End If End Using apiRequest = returnValue End Function End Module |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# std import logging import json from collections import OrderedDict # 3p import requests API_KEY = "MY API KEY" URL = "https://api.voicepartner.fr/v1" class SMSPartner(): def get_balance(self): url = URL + "/me/" + API_KEY r = requests.get(url) r_json = r.json() if r_json.get("success") == True: print(r_json) status = True else: print(r_json) status = False return status |
1 |
curl -H "Content-Type: application/json" -X GET https://api.voicepartner.fr/v1/me/xxx |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
const axios = require('axios'); // Replace 'YOUR_API_KEY' with your actual API key const apiKey = 'YOUR_API_KEY'; // The URL of the API with the API key appended const url = `https://api.voicepartner.fr/v1/me/${apiKey}`; axios.get(url) .then(response => { console.log('Response:', response.data); }) .catch(error => { console.error('Error:', error.response ? error.response.data : error.message); }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
package com.example.API; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; public class CreditVoix { public static void main(String[] args) { // Replace 'YOUR_API_KEY' with your actual API key String apiKey = "YOUR_API_KEY"; String url = "https://api.voicepartner.fr/v1/me/" + apiKey; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .build(); client.sendAsync(request, BodyHandlers.ofString()) .thenApply(HttpResponse::body) .thenAccept(System.out::println) .exceptionally(e -> { System.out.println("Error: " + e.getMessage()); return null; }) .join(); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
package main import ( "fmt" "io/ioutil" "net/http" ) func main() { apiKey := "YOUR_API_KEY" url := fmt.Sprintf("https://api.voicepartner.fr/v1/me/%s", apiKey) response, err := http.Get(url) if err != nil { fmt.Printf("Error: %s\n", err.Error()) return } defer response.Body.Close() body, err := ioutil.ReadAll(response.Body) if err != nil { fmt.Printf("Error: %s\n", err.Error()) return } fmt.Printf("Response: %s\n", string(body)) } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
using System; using System.Net.Http; using System.Threading.Tasks; namespace API.ApiClients { public class CreditVoix { public static async Task Main() { var apiKey = "YOUR_API_KEY"; var url = $"https://api.voicepartner.fr/v1/me/{apiKey}"; using (var client = new HttpClient()) { try { var response = await client.GetAsync(url); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine("Response: " + content); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } } } } } |
Réponses
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
{ "success": true, "credit": "19", "currency": "€", "details": { "tts": { "h": 5, "m": 55, "s": 66 }, "tts_fixe": { "h": 3, "m": 44, "s": 55 }, "voice": { "message": 10 } } } |
Code de contrôle
_ | Réponse |
---|---|
10 | Clé API incorrecte |
200 | Tout s’est bien passé ! |
© 2014 - 2023 NDA MEDIA. Tous droits réservés. Mentions légales