factureaza.ro
tu ce facturezi azi
testează acum ascunde interfața de test

Documentație API GRAPHQL

API (Application Programming Interface)
îți pune la dispoziție resursele

În continuare vei regăsi tot ce este necesar pentru integrarea cu sistemele tale software.

pentru documentația API REST(vechi) click aici

1. Resurse si URL-uri

Noul API factureaza.ro este un API GraphQL.

Îţi permite accesul flexibil la datele tale pe baza unui "query" prin care specifici exact datele care vrei să ţi se returneze. În mod similar poţi efetua şi operaţii de creare, editare şi ştergere a tuturor datelor relvante.

Documentaţia oficială GraphQL o găseşti aici.

2. Sistem sandbox pentru testarea API GRAPHQL

Pentru testarea funcțiilor API-ul factureaza.ro îţi punem la dispoziţie un sistem sandbox.
Acesta este disponibil la adresa: https://sandbox.factureaza.ro

Cheia API pentru teste: 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965

Datele de acces pentru intefaţa umană corespunzătoare utilizatorului cu cheia API de mai sus:

  • Adresa login: https://sandbox.factureaza.ro/graphql
  • Nume cont (login firmă): sandbox
  • Nume utilizator (login utilizator): dan.popescu
  • Parola: dAn.p0pescu

3. Autentificare

Cheia API este definită per utilizator și se poate (re)genera din contul tău factureaza.ro , la punctul “Contul meu” -> “Cheie API”

Sunt disponibile două metode de autentificare:

  • HTTP Authentication (se va folosi cheia API ca username, parola fiind ignorată)
  • Parametru api_key adăugat fiecărui request.

4. Rezultate și erori

Rezultatul unui request semnalează prin status-ul HTTP returnat:

  • 200 Success (după un request GET, PUT, sau DELETE reușit)
  • 201 Created (după un request POST reușit)
  • 400 Resource Invalid (request formatat greșit)
  • 401 Unauthorized
  • 404 Resource Not Found
  • 405 Method Not Allowed (Verbul HTTP folosit nu este acceptat pentru această resursă)
  • 422 Unprocessable Entity (Request-ul a fost sintactic corect, dar modificările cerute nu sunt valide)
  • 500 Application Error (Eroare în sistem)
  • Pentru cereri corecte sintactic, dar care nu îndeplinesc criteriile de validare ale sistemului, erorile vor fi returnate in corpul răspunsului.

5. Câmpuri și tipuri de date

Detalii despre datele returnate se pot vedea activând interfaţa de testare interactivă şi căutând după numele modelului sau al câmpului dorit în Documentation Explorer. Click aici pentru un exemplu.

  • formatul pentru dată este: AAAA-LL-ZZ
  • valori boolean vor fi reprezentate cu: true / false

6. Exemple query-uri

Exemplele de mai jos surprind doar câteva dintre posibilele câmpuri care se pot interoga. Pentru lista completă a tuturor câmpurilor, relaţiilor şi obiectelor imbricate te rugăm să consulţi documentaţia interactivă. Click aici pentru un exemplu.

6.1. Exemple de query-uri pentru contul tău (Model Account)

Detalii despre contul tău

Exemple de cod:

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a contului tău te rugăm să consulţi documentaţia interactivă.


6.2. Exemple de query-uri pentru clienţi (Model client)

Detalii client

    {
  clients(id: "1064116434") {
    id
    name
    email
    uid
    address
    city
    zip
    state
    telephone
    zip
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a clienților te rugăm să consulţi documentaţia interactivă.


Listare clienți

    {
  clients(limit: 1, offset: 1) {
    id
    name
    email
    uid
    address
    city
    zip
    state
    telephone
    zip
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Adăugare client

    mutation {
  createClient(
    uid: "12345678",
    name: "nume client",
    address: "adresa client",
    city: "Brasov",
    country: "RO"
    ) {
      id
      name
      email
      uid
      address
      city
      zip
      state
      telephone
      zip
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare client

    mutation {
  updateClient(
    id: "1064116434",
    name: "nume nou",
    country: "RO",
    uid: "3987985"
    ) {
      id
      name
      email
      uid
      country
      address
      city
      zip
      state
      telephone
      zip
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Ștergere client

    mutation {
  deleteClient(id: "1064116434") {
    id
    name
    email
    uid
    address
    city
    zip
    state
    telephone
    zip
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.3. Serii facturi (Model Invoice Series)

Detalii serie facturi

    {
  invoiceSeries(id: "1061104109") {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a seriilor de facturi te rugăm să consulţi documentaţia interactivă.


Listare serii facturi

    {
  invoiceSeries(limit: 1, offset: 1) {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Ștergere serie facturi

    mutation {
  deleteInvoiceSeries(id: "1061104109") {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Adăugare serie facturi

    mutation {
  createInvoiceSeries(
    counterStart: "1",
    counterCurrent: "422",
    year: "2019",
    prefix: "qwerty"
    ) {
      id
      createdAt
      counterStart
      counterCurrent
      prefix
      year
      sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare serie facturi

    mutation {
  updateInvoiceSeries(
      id: "1061104109",
      prefix: "wasd"
    ) {
      id
      createdAt
      counterStart
      counterCurrent
      prefix
      year
      sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.4. Facturi (Model Invoice)

Detalii facturi

    {
  invoices(id: "1065253899") {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    currency
    documentPositions {
      id
      price
      position
      total
      type
    }
    receipts {
      id
      amount
      clientId
      clientUid
      clientName
      delegateId
      delegateLastName
      delegateFirstName
    }
    inputCurrency
    payments {
      id
      paymentDate
      paymentType
      description
      createdAt
      currency
    }
    actionEvents {
      id
      description
      action
    }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a facturilor te rugăm să consulţi documentaţia interactivă.


Listare facturi

    {
  invoices(limit: 1, offset: 1) {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    currency
    documentPositions {
      id
      price
      position
      total
      type
    }
    receipts {
      id
      amount
      clientId
      clientUid
      clientName
      delegateId
      delegateLastName
      delegateFirstName
    }
    inputCurrency
    payments {
      id
      paymentDate
      paymentType
      description
      createdAt
      currency
    }
    actionEvents {
      id
      description
      action
    }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Ștergere facturi

    mutation {
  deleteInvoice(id: "1065253899") {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    currency
    documentPositions {
      id
      price
      position
      total
      type
    }
    receipts {
      id
      amount
      clientId
      clientUid
      clientName
      delegateId
      delegateLastName
      delegateFirstName
    }
    inputCurrency
    payments {
      id
      paymentDate
      paymentType
      description
      createdAt
      currency
    }
    actionEvents {
      id
      description
      action
    }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Adăugare facturi

    mutation {
  createInvoice(
    currency: "RON",
    clientId: "1064116434",
    documentSeriesId: "1061104069",
    documentDate: "05.07.2014",
    exchangeRate: "4.55",
    documentSeriesCounter: "475",
    vatType: "1",
    delegateId: "525664463",
    displayTransportData: "1",
    documentPositions: [{
      description: "ABONAMENT BASIC",
      unit: "luni",
      unitCount: "12",
      price: "12",
      productCode: "66XXH663496H",
      vat: "19"
    }]) {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    currency
    documentPositions {
      id
      price
      position
      total
      type
    }
    receipts {
      id
      amount
      clientId
      clientUid
      clientName
      delegateId
      delegateLastName
      delegateFirstName
    }
    inputCurrency
    payments {
      id
      paymentDate
      paymentType
      description
      createdAt
      currency
    }
    actionEvents {
      id
      description
      action
    }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare facturi

    mutation {
  updateInvoice(id: "1065253899", exchangeRate: "4.5", currency: "RON") {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    exchangeRate
    currency
    documentPositions {
      id
      price
      position
      total
      type
    }
    receipts {
      id
      amount
      clientId
      clientUid
      clientName
      delegateId
      delegateLastName
      delegateFirstName
    }
    inputCurrency
    payments {
      id
      paymentDate
      paymentType
      description
      createdAt
      currency
    }
    actionEvents {
      id
      description
      action
    }
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Convertește factura în format PDF codificat ca Base64 (funcționează pt toate tipurile de documente)

    {
  invoices(id: "1065253899") {
    id
    pdfContent
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a facturilor te rugăm să consulţi documentaţia interactivă.


Trimite factura pe e-mail

    mutation {
  sendDocument(to: "random_email@random_service.domain", documentId: "1065253899" body: "your invoice") {
    id
    description
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a facturilor te rugăm să consulţi documentaţia interactivă.


6.5. Serii avize (Model Notice Series)

Detalii serie aviz

    {
  noticeSeries(id: "1061104111") {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a seriilor de avize te rugăm să consulţi documentaţia interactivă.


Ștergere serie aviz

    mutation {
  deleteNoticeSeries(id: "1061104111") {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Adăugare serie aviz

    mutation {
  createNoticeSeries(counterStart: "1",
  counterCurrent: "422",
  year: "2019",
  prefix: "qwerty") {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare serie aviz

    mutation {
  updateNoticeSeries(id: "1061104111", prefix: "wasd") {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.6. Avize (Model Notice)

Detalii aviz

    {
  notices(id: "1065253945") {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    currency
    documentPositions {
      id
      price
      position
      total
      type
    }
    inputCurrency
    actionEvents {
      id
      description
      action
    }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a avizelor te rugăm să consulţi documentaţia interactivă.


Ștergere aviz

    mutation {
  deleteNotice(id: "1065253945") {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    currency
    documentPositions {
      id
      price
      position
      total
      type
    }
    inputCurrency
    actionEvents {
      id
      description
      action
    }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Adăugare aviz

    mutation {
  createNotice(
    currency: "RON",
    clientId: "1064116434",
    documentSeriesId: "1061104111",
    documentDate: "03.01.2019",
    exchangeRate: "4.55",
    documentSeriesCounter: "423",
    vatType: "1",
    delegateId: "525664463",
    displayTransportData: "1",
    documentPositions: [{
      description: "ABONAMENT BASIC",
      unit: "luni",
      unitCount: "12",
      price: "12",
      productCode: "66XXH663496H",
      vat: "19"
    }]) {
      id
      createdAt
      type
      accountBanks
      clientId
      clientUid
      clientName
      currency
      documentPositions {
        id
        price
        position
        total
        type
      }
      inputCurrency
      actionEvents {
        id
        description
        action
      }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare aviz

    mutation {
  updateNotice(id: "1065253945",
  exchangeRate: "4.5",
  currency: "EUR") {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    exchangeRate
    currency
    documentPositions {
      id
      price
      position
      total
      type
    }
    inputCurrency
    actionEvents {
      id
      description
      action
    }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.7. Plăți (Model Payment)

Detalii plată

    {
  payments(id: "969663475") {
    id
    createdAt
    description
    currency
    paymentType
    paymentDate
    amount
  }
 }
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a plăților te rugăm să consulţi documentaţia interactivă.


Adăugare plată

    mutation {
  createPayment(description: "descriere plata",
    currency: "RON",
    paymentDate: "14.11.2019",
    proformaInvoiceId: "1065253930"
    invoiceId: "1065253899",
    amount: "200"
   ) {
      id
      createdAt
      description
      currency
      paymentType
      paymentDate
      amount
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare plată

    mutation {
  updatePayment(id: "969663475",
    description: "descriere noua",
    currency: "RON"
    ) {
      id
      createdAt
      description
      currency
      paymentType
      paymentDate
      amount
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Ștergere plată

    mutation {
  deletePayment(id: "969663475") {
    id
    createdAt
    description
    currency
    paymentType
    paymentDate
    amount
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.8. Produse (Model Product)

Detalii produs

    {
  products(id: "741342701") {
    id
    createdAt
    description
    code
    price
    quantity
    unit
    currency
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a produselor te rugăm să consulţi documentaţia interactivă.


Adăugare produs

    mutation {
  createProduct(description: "descriere produs",
    currency: "EUR"
    ) {
      id
      createdAt
      description
      code
      price
      quantity
      unit
      currency
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare produs

    mutation {
   updateProduct(id: "741342701",
   description: "descriere noua",
   currency: "EUR") {
     id
     createdAt
     description
     code
     price
     quantity
     unit
     currency
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Ștergere produs

    mutation {
   deleteProduct(id: "741342701") {
     id
     createdAt
     description
     code
     price
     quantity
     unit
     currency
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.9. Serii facturi proforme (Model Proforma Invoice Series)

Detalii serie factură proforma

    {
  proformaInvoiceSeries(id: "1061104115") {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
   }
 }
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a seriilor facturilor proforme te rugăm să consulţi documentaţia interactivă.


Adăugare serie factură proforma

    mutation {
  createProformaInvoiceSeries(
    counterStart: "1",
    counterCurrent: "422",
    year: "2019",
    prefix: "qwerty"
  ) {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare serie factură proforma

    mutation {
  updateProformaInvoiceSeries(id: "1061104115", prefix: "wasd") {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Ștergere serie factură proforma

    mutation {
   deleteProformaInvoiceSeries(id: "1061104115") {
     id
     createdAt
     counterStart
     counterCurrent
     prefix
     year
     sepparator
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.10. Facturi proforme (Model Proforma Invoice)

Detalii factură proforma

    {
  proformaInvoices(id: "1065253930") {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    currency
    documentPositions {
      id
      price
      position
      total
      type
    }
    inputCurrency
    payments {
      id
      paymentDate
      paymentType
      description
      createdAt
      currency
    }
    actionEvents {
      id
      description
      action
    }
   }
 }
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a facturilor proforme te rugăm să consulţi documentaţia interactivă.


Ștergere factură proforma

    mutation {
   deleteProformaInvoice(id: "1065253930") {
     id
     createdAt
     type
     accountBanks
     clientId
     clientUid
     clientName
     currency
     documentPositions {
       id
       price
       position
       total
       type
     }
     inputCurrency
     payments {
       id
       paymentDate
       paymentType
       description
       createdAt
       currency
     }
     actionEvents {
       id
       description
       action
     }
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Adăugare factură proforma

    mutation {
  createProformaInvoice(
    currency: "RON",
    clientId: "1064116434",
    documentSeriesId: "1061104115",
    documentDate: "03.04.2020",
    exchangeRate: "4.55",
    documentSeriesCounter: "423",
    vatType: "1",
    delegateId: "525664463",
    displayTransportData: "1",
    documentPositions: [{
      description: "ABONAMENT BASIC",
      unit: "luni",
      unitCount: "12",
      price: "12",
      productCode: "66XXH663496H",
      vat: "19"
    }]) {
      id
      createdAt
      type
      accountBanks
      clientId
      clientUid
      clientName
      currency
      documentPositions {
        id
        price
        position
        total
        type
      }
      inputCurrency
      payments {
        id
        paymentDate
        paymentType
        description
        createdAt
        currency
      }
      actionEvents {
        id
        description
        action
      }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare factură proforma

    mutation {
   updateProformaInvoice(id: "1065253930", exchangeRate: "4.5", currency: "RON") {
     id
     createdAt
     type
     accountBanks
     clientId
     clientUid
     clientName
     currency
     documentPositions {
       id
       price
       position
       total
       type
     }
     inputCurrency
     payments {
       id
       paymentDate
       paymentType
       description
       createdAt
       currency
     }
     actionEvents {
       id
       description
       action
     }
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.11. Serii chitanțe (Receipt Series)

Detalii serie chitanță

    {
  receiptSeries(id: "1061104112") {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a seriilor de chitanțe te rugăm să consulţi documentaţia interactivă.


Ștergere serie chitanță

    mutation {
   deleteReceiptSeries(id: "1061104112") {
     id
     createdAt
     counterStart
     counterCurrent
     prefix
     year
     sepparator
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Adăugare serie chitanță

    mutation {
  createReceiptSeries(counterStart: "1",
    counterCurrent: "422",
    year: "2019",
    prefix: "qwerty"
  ) {
    id
    createdAt
    counterStart
    counterCurrent
    prefix
    year
    sepparator
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare serie chitanță

    mutation {
   updateReceiptSeries(id: "1061104112", prefix: "wasd") {
     id
     createdAt
     counterStart
     counterCurrent
     prefix
     year
     sepparator
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.12. Chitanțe (Model Receipt)

Detalii chitanță

    {
  receipts(id: "1065253922") {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    currency
    inputCurrency
    actionEvents {
      id
      description
      action
    }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a chitanțelor te rugăm să consulţi documentaţia interactivă.


Ștergere chitanță

    mutation {
   deleteReceipt(id: "1065253922") {
     id
     createdAt
     type
     accountBanks
     clientId
     clientUid
     clientName
     currency
     inputCurrency
     actionEvents {
       id
       description
       action
     }
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Adăugare chitanță

    mutation {
  createReceipt(
    currency: "RON",
    clientId: "1064116434",
    documentSeriesId: "1061104112",
    documentDate: "01.04.2019",
    documentSeriesCounter: "21123333",
    receiptAmount: "23",
    invoiceId: "1065253899",
    vatType: "1",
    delegateId: "525664463",
    displayTransportData: "false",
    invoiceDate: "29.03.2019"
  ) {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    currency
    inputCurrency
    actionEvents {
      id
      description
      action
    }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare chitanță

    mutation {
  updateReceipt(id: "1065253922",
    exchangeRate: "4.5",
    currency: "EUR"
  ) {
    id
    createdAt
    type
    accountBanks
    clientId
    clientUid
    clientName
    currency
    inputCurrency
    actionEvents {
      id
      description
      action
    }
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.13. Utilizatori (Model User)

Detalii despre utilizatorii contului

    {
  users(id: "525664463") {
    id
    firstName
    lastName
    telephone
    email
    cnp
    identityDocumentNumber
    identityDocumentSeries
    identityDocumentIssuedBy
    identityDocumentIssueDate
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Pentru o listă completă a câmpurilor, relaţiilor şi obiectelor imbricate a utilizatorilor te rugăm să consulţi documentaţia interactivă.


6.14. Abonamente (Model Recurrent)

Detalii despre abonamente

    {
   recurrents(id: "930987061") {
     id
     scheduleUnit
     scheduleUnitCount
     name
     documentSeriesPrefix
     description
     documentType
     recurrentJobs {
       id
       clientId
       paymentStartAt
       scheduleAnchor
       locale
       coveredUntil
       price
       vat
       paymentEndAt
     }
     invoices {
       id
       createdAt
       type
       accountBanks
       clientId
       clientUid
       clientName
       currency
     }
   }
 }
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.15. Abonați (Model Recurrent Job)

Detalii despre abonați

    {
   recurrentJobs(id: "13") {
     id
     recurrentId
     clientId
     paymentStartAt
     scheduleAnchor
     locale
     coveredUntil
     price
     vat
     paymentEndAt
     destinationEmail
     recurrentJobRuns {
       id
       periodEndAt
       periodStartAt
       documentId
     }
   }
 }
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Ștergere abonat

    mutation {
     deleteRecurrentJob(id: "13") {
       id
       recurrentId
       clientId
       paymentStartAt
       scheduleAnchor
       locale
       coveredUntil
       price
       vat
       paymentEndAt
       destinationEmail
       recurrentJobRuns {
         id
         periodEndAt
         periodStartAt
         documentId
       }
     }
  }
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Adăugare abonat

    mutation {
  createRecurrentJob(
    recurrentId: "930987061",
    clientId: "1064116434",
    paymentStartAt: "14.11.2019"
  ) {
    id
    recurrentId
    clientId
    paymentStartAt
    scheduleAnchor
    locale
    coveredUntil
    price
    vat
    paymentEndAt
    destinationEmail
    recurrentJobRuns {
      id
      periodEndAt
      periodStartAt
      documentId
    }
  }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

Modificare abonat

    mutation {
   updateRecurrentJob(id: "13", paymentStartAt: "12.03.2015") {
     id
     recurrentId
     clientId
     paymentStartAt
     scheduleAnchor
     locale
     coveredUntil
     price
     vat
     paymentEndAt
     destinationEmail
     recurrentJobRuns {
       id
       periodEndAt
       periodStartAt
       documentId
     }
   }
}
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

6.16. Rularea abonamentului (Model Recurrent Job Run)

Detalii despre rularea abonamentului

    {
   recurrentJobRuns(id: "809119964") {
     id
     documentId
     periodStartAt
     createdAt
     updatedAt
   }
 }
  

Exemple de cod:

      
curl -i -H 'Content-Type: application/json' -u 72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965:x -X POST -d '{"query": "{{code_example}}"}' https://sandbox.factureaza.ro/graphql
      
    
      
<?php

require_once('graphql-settings.php');

define('BASE_URL', 'https://sandbox.factureaza.ro/graphql'); define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$ch = curl_init(); require_once('graphql-functions.php');
$url = BASE_URL; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x"); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json') );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query": "{{code_example}}"}'); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo($httpCode . "\n" . $result . "\n"); curl_close($ch);
      
#!/usr/bin/env ruby
require "base64"
require 'graphlient'
base_url = 'https://sandbox.factureaza.ro/graphql'
api_key = '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965'
encoded_credentials = #{ ::Base64.strict_encode64("#{api_key}:") }
headers = { Authorization: "Basic #{encoded_credentials}" }
graphql_client = Graphlient::Client.new(base_url, { headers: headers })
query_string = <<~GRAPHQL
  {{code_example}}
GRAPHQL
response = graphql_client.query query_string
response.data.clients.each { |cl| puts "Id: #{cl.id} Name: #{cl.name}" }.size
      
    
      
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text;
namespace c_
{
  class Program
  {
    static void Main(string[] args)
    {
      var query = "{{code_example}}";
      var baseUri = "https://sandbox.factureaza.ro/graphql";
      var apiKey = "72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965";
      var queryParams = new FormUrlEncodedContent(new[]
        {
           new KeyValuePair<string, string>("query", query)
        });

      var client = new HttpClient();
      var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey + ":"));

      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

      var response = client.PostAsync(baseUri, queryParams).Result;
      var responseString = response.Content.ReadAsStringAsync();
      if (response.IsSuccessStatusCode)
      {
        System.Console.WriteLine(response);
        System.Console.WriteLine(responseString.ToString());


        foreach (var character in responseString.Result)
          System.Console.Write(character);
        System.Console.WriteLine();
      }
    }
  }
}
      
    
      
import java.net.*;
import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

public class Graph {
  public static void main(String[] args){

    String query = "{\"query\":\"{{code_example}} \" }";
    byte[] postData = query.getBytes(StandardCharsets.UTF_8);
    String apiKey = "743b27b9e2ba33269bca4506f858637739fca1f60562132c5b5463e40e4a"; 
         URL serverUrl = new URL("http://localhost:3200/graphql");
    String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString((apiKey + ":").getBytes());

    BufferedReader httpResponseReader = null;
      try {
        HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

        urlConnection.setDoOutput(true);
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/json");
        urlConnection.addRequestProperty("Authorization", basicAuthPayload);

        try (DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream())) {
          wr.write(postData);
          wr.flush();
          wr.close();
        }

          httpResponseReader =
            new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
          String lineRead;
          while((lineRead = httpResponseReader.readLine()) != null) {
            System.out.println(lineRead);
          }

        } catch (IOException ioe) {
          ioe.printStackTrace();
        } finally {

          if (httpResponseReader != null) {
            try {
              httpResponseReader.close();
            } catch (IOException ioe) {
                    // Close quietly
            }
          }
        }
  }
}
      
    

7. Callback la înregistrarea unei plăți online

După înregistrarea unei plăți online se trimite o structură de date cu detaliile facturii și a plății pe această adresă prin HTTP POST la adresa specificată în câmpul Callback URL al formularui de editare a parametrilor funcției de plată online.

Exemplu de cod:

<?php
// write post parameters to file - sample code for processing the callback after successfull payment
$file_name_json = 'factureaza_callback_post_content.json';
$document_as_json = file_get_contents('php://input');

$fp_json = fopen($file_name_json, 'wt') or die('Could not open file! Make sure you have permission to create the file ' . $file_name_json);
fwrite($fp_json, $document_as_json) or die('Could not write to file! Make sure you have write permission for the file ' . $file_name_json);
fclose($fp_json);
?>