Resolving issues with CURL requests to API