The Jira API is less fragile than this, you will still have to change major things to your script when someone adds a field.