Fixed connection bug in sendDataToAPI method.

Jira issue: WP-595