Depuis le swagger https://consult.api.yodaforex.cloud/swagger-ui/ vous pouvez renseigner votre clé d'API en cliquant sur le bouton "Authorize" en haut à droite.
Pour utiliser l'API dans votre développement, il est nécessaire de passer votre clé d'API avec le header X-Api-Key
pour chacune de vos requêtes.
Votre URL d'appel sera composée de l'URL de l'API (exemple https://consult.api.yodaforex.cloud
)+ celle du End Point voulu (exemple /v1/invoice-lines/B3E05CF5D1A84CB89AA6EA29C88D4DE6
).
Exemple en PHP avec cURL
function requestYfxWebConnect( $url, $key, $json = true, $data = array(), $type = 'GET' ) { $curl = curl_init(); curl_setopt_array( $curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_CUSTOMREQUEST => $type, CURLOPT_HTTPHEADER => array( "X-Api-Key: " . $key . "", "content-type: application/json", "accept: application/json" ), CURLOPT_POSTFIELDS => ( !empty( $data ) ) ? json_encode( $data ) : null, ) ); $response = curl_exec( $curl ); $err = curl_error( $curl ); curl_close( $curl ); if ( $err ) { echo "cURL Error #:" . $err; return false; } else { return json_decode( $response, true ); } }
Commentaires
0 commentaire
Vous devez vous connecter pour laisser un commentaire.