Loading....

Introduction

The help offered by the AIFE will allow you to make the first tests and API calls to qualification then to production. These helps are to be shared with the API developer community. You can contribute to the enrichment of these aids by contacting us by e-mail. e-mail.

Rappel des pré-requis

Here are the prerequisites to be able to make API calls in qualification:

These four steps allow you to make API calls in qualification.

1er test API avec SOAP UI

Test pas à pas

ChorusPro platform allows webservices to manage invoices sent to institutional clients. To make the connection, you need: - an identified structure (SIRET of the master company) which possibly supervises other structures (other SIRET) - a manager user (main or secondary) - a technical user account attached to the structure - activate API access rights for this structure - save the SSL certificate of this entity - the SSL certificate: o in p7b format: to save it on Chorus Pro o in p12 format: to save it in SOAPUI

  • Install SOAPUI
  • Have the SSL key in P7B and p12 formats

SOAPUI settings

In the Files> Preferences…> SSL Settings menu

Loading a library of REST functions

Create a new REST project by importing a WADL file Download WADL files: AIFE-Chorus-Pro-Exemples_JSON_WADL.zip This operation constitutes a list of functions

 SOAPUI Interface

Interrogation of a function

To query a request, you must: - Open the request (double click) - Display the Inspector ‘Auth’ of the request - In the ‘Authorization’ combo box - ‘Add a new Authorization’

- It will be 'basic'

-Fill in the authentication information for the technical account (communicated in the Excel file for setting up the data mattress or when creating the technical account associated with the manager's account) - Check that the port (5443) of the ‘endpoint’ is configured in the ‘request path’ - Complete the JSON request. Copy and paste a. either from the chorus portal documentation: for the example of this document, all you have to do is google ogle chorus pro invoices consult supplier ’ either from the JSON file libraries given in examples: \\ $$$ \ Tmp \ AIFE-Chorus-Pro- Examples_JSON_WADL \ JSON - Adapt the JSON file to the situation: I used the id of the first user and the id of the first invoice indicated in the trace file of creation of the data mattress (lines 9 and 176) - Launch the request with the PLAY button - On the right part of the screen appears the answer, it may be necessary to select a JSON display mode instead of HTML - In the left part, you can display the request in raw format: - We can note in the inspector the presence of the SSL tab which indicates the certificate used… while it is not in the raw file
The expected encoding format: the encoding of the content must be mandatory in UTF-8 (Content-Type: charset = UTF-8)

Utilisation de CURL pour faire les appels API

The use of the certificate in P12 format is necessary. Here is an example of a CURL call on a repository API:

curl --cert cert.crt.pem --key cert.key.pem -H "Content-Type: application/json;charset=UTF-8" -d "{}" -H "Authorization: Basic XXXXXXX" -X POST https://chorus-pro.gouv.fr:5443/service-qualif/transverses/recuperer/pays/

Here is an example of a CURL call on an API with a file containing the input JSON:

curl –cert cert.crt.pem –key cert.key.pem -H "Content-Type: application/json;charset=UTF-8" --data @fichier.json -H "Authorization: Basic XXXXXXX" -X POST https://chorus-pro.gouv.fr:5443/service-qualif/factures/rechercher/recipiendaire"

With XXXXXXX : 'loginCompteTechnique:MotDePasse' encoded in base 64 Make sure that the root and intermediate certification authorities of your certificate are in your certificate store (server) To extract the certificate and key files from your certificate, you can consult the online documentation of openSSL.

Print Friendly, PDF & Email

Last Update: January 3, 2020  

1570  
Back To Top