Applatix / claudia

Other
39 stars 11 forks source link

Question: Importing account aliases #6

Closed wwsean08 closed 7 years ago

wwsean08 commented 7 years ago

Is there an API or way to automate importing account aliases? Even if I could pass in a csv file with account number to alias that would make life so much easier. I haven't looked thru the code yet to determine the underlying API in order to automate it but was wondering if there is an officially supported way to automate importing it as importing one or two manually is fine, when you have over 100 accounts it gets a bit tedious.

jessesuen commented 7 years ago

There is no formal API, but you can follow what the UI is doing via REST:

  1. Login with your admin and password, and retrieve a session cookie:
curl 'http://claudiaurl.com/v1/auth/login' --data-binary $'{\n  "username": "admin",\n  "password": "<your_password>"\n}'
  1. Get the report ID:

    curl 'http://claudiaurl.com/v1/reports' -H 'Cookie: session=<your session cookie>'
  2. Update a single account:

    curl 'http://claudiaurl.com/v1/reports/<your report id>/accounts/<aws_account_id>' -H 'Cookie: session=<your session cookie>' -H --data-binary $'{\n  "name": "<account alias name>"\n}'
wwsean08 commented 7 years ago

Thanks, that's what I figured