Commande VPS via API /order
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
question

Commande VPS via API /order

Par
AlexisL1
Créé le 2020-08-10 09:35:48 (edited on 2024-09-04 12:18:26) dans Serveurs Privés Virtuels (VPS)

Bonjour à tous,
J'ai créé un script me permettant d'intéragir avec l'API vps pour gérer ceux-ci via l'API.
Cependant, lorsque je passe sur l'API /order pour commander un nouveau VPS, un problème se pose lors de la validation du panier :
```
Traceback :

Traceback (most recent call last):
File "./order.py", line 608, in commitCart
salesorder = client.get("/order/cart/%s/checkout" % cartId)
File "/usr/local/lib/python3.8/dist-packages/ovh/client.py", line 347, in get
return self.call('GET', _target, None, _need_auth)
File "/usr/local/lib/python3.8/dist-packages/ovh/client.py", line 456, in call
raise APIError(json_result.get('message'), response=result)
ovh.exceptions.APIError: You are not allowed
OVH-Query-ID: xxxxx
```
Les droits sur la clé d'API utilisée sont les suivants (RW /*) :
```
{'status': 'validated', 'lastUse': '2020-08-07T18:22:49+02:00', 'credentialId': XXX, 'rules': [{'method': 'GET', 'path': '/*'}, {'method': 'POST', 'path': '/*'}, {'method': 'PUT', 'path': '/*'}, {'path': '/*', 'method': 'DELETE'}], 'allowedIPs': None, 'expiration': '2020-08-08T17:40:04+02:00', 'applicationId': YYY, 'creation': '2020-08-07T17:39:33+02:00', 'ovhSupport': False, 'description': None, 'method': 'account', 'user': None, 'roles': ['ADMIN']}
```

Mon cheminement :

* `cart = client.post('/order/cart', ovhSubsidiary='FR')`
* `client.post("/order/cart/%s/assign" % cart['cartId'])`
* `result = client.post(uri, duration=order_params['duration'], planCode=order_params['plan'], pricingMode=order_params['payment'], quantity=int(order_params['quantity']))`
* `salesorder = client.get("/order/cart/%s/checkout" % cartId)`

À ce moment, une exception est levée : **You are not allowed**

Si quelqu'un a une idée, je suis preneur !

Merci d'avance :)


Les réponses sont actuellement désactivées pour cette question.