Use Java to call the sprint interface in the rest api and insert it into the sprint field in story.
Do you want to set the sprint field of an issue with an existing sprint? Then you should use:
POST /rest/agile/1.0/sprint/{sprintId}/issue
You can find more info here:
https://docs.atlassian.com/jira-software/REST/7.0.4/#agile/1.0/sprint-moveIssuesToSprint
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.