title: CURL HTTP2 request
body: <p>I would like to know if someone successfully managed to send a push notification through the new APNS API (HTTP2)using CURL.</p>
  
  <p>An example request's given on the <a href="https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW10" rel="noreferrer">APNs Provider API page</a></p>
  
  <p>Here's how the request must be:</p>
  
  <p>HEADERS</p>
  
  <pre><code>\- END_STREAM
  
  \+ END_HEADERS
  
  :method = POST
  
  :scheme = https
  
  :path = /3/device/00fc13adff785122b4ad28809a3420982341241421348097878e577c991de8f0
  
  host = api.development.push.apple.com
  
  apns-id = eabeae54-14a8-11e5-b60b-1697f925ec7b
  
  apns-expiration = 0
  
  apns-priority = 10
  
  content-length = 33
  </code></pre>
  
  <p>DATA</p>
  
  <pre><code>\+ END_STREAM
  
  { "aps" : { "alert" : "Hello" } }
  </code></pre>
  
  <p>But with the following command I get error "curl: (16) HTTP/2 stream 1 was not closed cleanly: error_code = 8":</p>
  
  <pre><code>curl \
  
  --verbose \
  
  --http2 \
  
  --cert &lt;APPLICATION_CERT_FILE&gt; \
  
  --key &lt;APPLICATION_KEY_FILE&gt; \
  
  --header "Content-Type: application/json" \
  
  --header ":method: POST" \
  
  --header ":path: /3/device/&lt;DEVICE ID&gt;" \
  
  --data '{ "aps" : { "alert" : "Hello" } }' \
  
  https://api.development.push.apple.com
  </code></pre>
  
  <p>Any tips?</p>