Open Simran-B opened 6 years ago
Hi @Simran-B @tariqdaouda , I was thinking about adding functionality to do a rest call to db object and connection object for any action that needs to be done.
connection.action.post(
'/_api/collection/<collectionHandle>/rename', json={'name': 'newname'}
)
Like a way a to send arbitrary calls to the db? I think that would be cool and would add a lot of flexibility.
Alternatively, I have written a driver for the Stock market AlphaVantage API. It uses a trick to define API calls without having to actually implement them. That could serve as an inspiration:
https://github.com/tariqdaouda/pyAlphaVantage/blob/master/pyAlphaVantageAPI/AlphaVantageAPI.py
Okay, I will look into it.
Thanks
Hi @tariqdaouda @Simran-B , Please check the pull request(https://github.com/ArangoDB-Community/pyArango/pull/155) which has the implementation for action in Connection and DB, which can be later used for creating functions which represent the rest apis provided by ArangoDB.
ArangoDB version: 3.3.12 pyArango version: 1.3.1 (via pip)
See https://stackoverflow.com/questions/51362259/rename-collection-with-pyarango
To rename a collection, it is necessary to pass a JSON body
{"name":"newname"}
in a PUT request to/_api/collection/<collectionHandle>/rename
. The.action()
method only supports passing on URL path params however.The HTTP docs also describe that there would be a path parameter
?collection-name=newname
but it is not support anymore (I tried with curl but got errors back about name being empty as if no parameter for name or collection-name was passed).It would be nice if the action method and possibly others too would support passing a body.