curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP2 push notifications - APNs JSON response

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 8 Dec 2016 17:52:47 -0500

On 12/8/2016 5:19 PM, Miloš Ljumović wrote:
> I am successfully using libcurl to send push notifications towards
> Apple APN service.
> Recently I learned that when response code is other than 200 (success)
> APN sends additional JSON information about error:
>
> https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html
>
> See table "Table 8-5APNs JSON data keys".
>
> I was observing both:
> https://curl.haxx.se/libcurl/c/curl_easy_getinfo.html
> and struct Curl_easy, but I couldn't find a way to retrieve above JSON
> information.
>
> Can someone point me out how to achieve this?

Before the transfer set CURLOPT_WRITEFUNCTION [1] so you can capture the
body when the transfer occurs. After the transfer if CURLE_OK use
CURLINFO_RESPONSE_CODE [2] to get the code.

[1]: https://curl.haxx.se/libcurl/c/CURLOPT_WRITEFUNCTION.html
[2]: https://curl.haxx.se/libcurl/c/CURLINFO_RESPONSE_CODE.html

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-12-08