Technical Articles
Introducing the CPI CLI (Command Line Interface) V0.0.1
A few weeks ago I set myself the challenge of learning Python and, as I am firmly convinced that the best way to learn is by doing, I started a side project to create a command line interface for CPI.
I don’t have anything against UI5 or Fiori, but sometimes I think it’s not the best UI for handling systems like CPI. (Maybe I have spent too much time working on PO). Very simple activities take a lot of clicks and scrolls. It is not possible to export lists or take general snapshots of contents, nor is there a simple way to mechanize processes. Eclipse was somewhat compliant with this, but as we know, it is going out of use.
On the other hand, a command line interface is very different as it has no visual effects, nor the “wow” effect, however it can be very efficient and can be complemented with many other powerful programs that are able to interact with the STDIN and STDOUT (such us “grep” and “more”). It also lets you write small scripts that allow you to mechanize processes or execute them “en masse”.
Regarding my adventure learning Python, I’ve learned a lot along the way, but I don’t go from being a novice. This is why I still don’t want to release the code to the community as I still want to incorporate some points and polish my skills before doing so. However, I want to share with the community the first alpha version of this interface.
You can download it for windows and linux from here: http://bit.ly/CPI-CLI-001
- Windows (Unsigned Installer -> Warning of “Unknown publisher”)
- Windows (Portable)
- Linux (OpenSuse)
Please, remember this is only for demos and a alpha release. In other words, use it at your own risk. The CLI is prompt to errors and nasty things like “odata injection” (if that’s a thing) are not controlled.
This first version, only has some very simple features:
– Login / Logout
– List of nodes
– Listing and filtering of messages
– List of contents (Iflows, Odata Services, Value Mappings)
– Content download
In the roadmap I have:
– List of credentials (and perhaps their content)
– Download of: tail logs, http and node traces
– iFlow parameter Maintenance
– Backup and Snapshots of integration contents
– Push and Commits to GIT repositories
– I accept suggestions!
Your constructive feedback would be very welcome. Feel free to reach out if you have any questions or ideas to implement.
Ariel Bravo Ayala
Basic examples
Help: (You can use the –help in all the commands)
cpi --help
Command “login”:
cpi login -u ariel.bravo@xxxxxxxx -h yyyyy-tmn.hci.zzz.hana.ondemand.com
Command “list”
- List first 10 error messages:
cpi list messages -e -top 10
- List messages from the 2019-01-23 15:15 to the 2019-01-23 15:25
cpi list messages -f 2019-01-23T15:15:00 -t 2019-01-23T15:30:00
- List all the integration content
cpi list content
Command “download”
- Download an iFlow
cpi download -id <SymbolicNameOfTheArtefact>
Hi Ariel,
First of all many thanks for sharing such a useful tool. Cannot wait for next version!!!
However, when i try to login using CLI to my CPI account i get error as in following snapshot. I use both Email as well as P ID to login. This P ID is already being tested by me in browser session and has sufficient roles and privileges but using CLI it throws an error.
Snapshot:
Do you know what could be the reason?
Thanks
Saurabh
Hi Saurabh,
Thanks for your words, I'll keep you posted with the updates.
The CLI uses two approaches: calls to the Odata API, and mimic the eclipse tool. My user has very powerful roles, so I did not test the required roles.
Could you please check these things?
Thanks,
Ariel
Aah...Now i am able to log in, after assigning 2 roles you mentioned in your comment.
Thanks for your prompt reply.
Regards
Saurabh
Hi Ariel,
Nice blog and informative, as always . I have followed your previous blogs also very nice.
Thanks ,
Vijay.
Thanks Vijay, this is the sort of comments that keeps me motivated!
Ariel
Great work, I will be waiting for the next version. Thanks.
Many Thanks!!!, for Finding new ways to explore more on CPI.
Dose it provide deployment of iFlow on Tenant?
Thanks,
Prathamesh
Hi Ariel,
I used to play around in Neo, but I haven't been able to connect for CF.
am I missing something or is not supported?
Kind regards,
Ric