How do I create permissions from the Management API?

Glad you figured it out and thank you for sharing it with the rest of community!