Set Parent/Child programatically

Seamless's picture

I can see how in the GUI to link one incident to another. But if two incidents come in from an alerting system what method can I use to link them? For example, if I get two alerts from the same server, I should be able to match them up and create one incident with a parent/child relationship. How can I do that?
Thanks,