GithubHelp home page GithubHelp logo

java-api-client's Introduction

java-api-client

Mifiel API Client for Java

Java SDK for Mifiel API. Please read our documentation for instructions on how to start using the API.

Installation

TODO

Usage

For your convenience Mifiel offers a Sandbox environment where you can confidently test your code.

To start using the API in the Sandbox environment you need to first create an account at sandbox.mifiel.com.

Once you have an account you will need an APP_ID and an APP_SECRET which you can generate in sandbox.mifiel.com/access_tokens.

Then you can configure the library with:

  import com.mifiel.api.ApiClient;

  ApiClient apiClient = new ApiClient(appId, appSecret);
  // if you want to use our sandbox environment use:
  apiClient.setUrl("https://sandbox.mifiel.com");

Document methods:

  • Find:

      import com.mifiel.api.dao.Documents;
      import com.mifiel.api.objects.Document;
    
      Documents documents = new Documents(apiClient);
      Document document = documents.find("id");
      document.getOriginalHash();
      document.getFile();
      document.getFileSigned();
      // ...
  • Find all:

      import java.util.List;
      import com.mifiel.api.dao.Documents;
      import com.mifiel.api.objects.Document;
    
      Documents documents = new Documents(apiClient);
      List<Document> allDocuments = documents.findAll();
  • Create:

Use only original_hash if you dont want us to have the file.
Only file or original_hash must be provided.

  import java.util.List;
  import java.util.ArrayList;
  import com.mifiel.api.dao.Documents;
  import com.mifiel.api.objects.Document;
  import com.mifiel.api.objects.Signature;
  import com.mifiel.api.utils.MifielUtils;

  Documents documents = new Documents(apiClient);
  Document document = new Document();
  document.setFile("path/to/my-file.pdf");

  List<Signature> signatures = new ArrayList<Signature>();
  Signature signature1 = new Signature();
  Signature signature2 = new Signature();

  signature1.setSignature("Signer 1");
  signature1.setEmail("[email protected]");
  signature1.setTaxId("AAA010101AAA");

  signature2.setSignature("Signer 2");
  signature2.setEmail("[email protected]");
  signature2.setTaxId("AAA010102AAA");

  signatures.add(signature1);
  signatures.add(signature2);

  document.setSignatures(signatures);
  documents.save(document);

  // if you dont want us to have the PDF, you can just send us
  // the original_hash and the name of the document. Both are required
  Document document2 = new Document();
  document2.setOriginalHash(MifielUtils.getDocumentHash("path/to/my-file.pdf"));
  document2.setSignatures(signatures);

  documents.save(document2);
  • Save signed files
  import com.mifiel.api.dao.Documents;

  Documents documents = new Documents(apiClient);

  // download the signed pdf
  documents.saveSignedFile("id", "path/to/save/file-signed.pdf");
  // download the signed xml file
  documents.saveXml("id", "path/to/save/xml.xml");
  // download zip file containing the signed pdf and the xml
  documents.saveZip("id", "path/to/save/xml.xml");
  • Delete

      import com.mifiel.api.dao.Documents;
      import com.mifiel.api.objects.Document;
    
      Documents documents = new Documents(apiClient);
      documents.delete("id");

java-api-client's People

Contributors

genaromadrid avatar enriquerivera avatar jazavala avatar jorge-aceves avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.