AT+CIPSEND
ERROR <-- you don't check the ERROR, that may be due to transient conditions
{"method" : "put","resource" : "/feeds/119703","params" : {},"hAT+CIPCLOSE <-- so you send the data without waiting for the > prompt
CLOSE OK <-- but CIPCLOSE works
AT+CIPSTART="TCP","api.cosm.com","8081"
OK
COAT+CIPSEND <-- while this time it works
> {"method" : "put","resource" : "/feeds/119703","params" : {},"hAT+CIPCLOSE
CLOSE OK
The code seems to work after all, and it could be that api.cosm.com is overloaded and sometimes unreachable. Your code should check the error and retry until successful, and possibly wait for the > prompt before sending the data. But if you suspect there are bugs in your code you should post it.
Could be, but consider that GPRS is much less reliable than your usual internet connection and depends on the strength of the GSM signal in your place, which may vary for causes outside your control. You may try moving around in search of a stronger signal.