Exemples de codes d'authentification
- Mode basic
Exemple cURL
curl -X GET \ https://secure.lyra.com/marketplace-test/marketplaces/57595c55-b096-41d8-9287-b98640de3f25 \ -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -H 'cache-control: no-cache'
Exemple de requête complète en Python
import requests def get_marketplace_details(): uuid = "57595c55-b096-41d8-9287-b98640de3f25" url = f"https://secure.lyra.com/marketplace-test/marketplaces/{uuid}" return requests.get(url, auth=(login, password), headers={'content-type': 'application/json'})
Exemple de requête en .NET
var myURL = "https://secure.lyra.com/marketplace-test/orders?expand=items" HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(myURL); myHttpWebRequest.ContentType = "application/json"; myHttpWebRequest.Accept = "application/json"; myHttpWebRequest.Method = "post"; string authInfo = userName + ":" + userPassword; authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo)); myHttpWebRequest.Headers["Authorization"] = "Basic " + authInfo;
- Mode OAuth2
Exemple cURL
curl -X GET \ https://secure.lyra.com/marketplace-test/v1/marketplaces/57595c55-b096-41d8-9287-b98640de3f25 \ -H 'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOi2lkIiA6ICJocXFZcjNkSlYycH...' \ -H 'cache-control: no-cache'
Exemple de requête complète en Python
import requests def get_marketplace_details(): uuid = "57595c55-b096-41d8-9287-b98640de3f25" url = f"https://secure.lyra.com/marketplace-test/v1/marketplaces/{uuid}" access_token = get_access_token() return requests.get(url, headers={'authorization': f"Bearer {access_token}", 'content-type': 'application/json'})