# Implementing a "keepAlive" call to Betfair's API

**URL:** <https://discourse.julialang.org/t/implementing-a-keepalive-call-to-betfairs-api/44363>\
**Category:** New to Julia\
**Created:** [August 5, 2020, 7:43pm UTC](https://discourse.julialang.org/t/implementing-a-keepalive-call-to-betfairs-api/44363 "2020-08-05T19:43:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nash/32/14482_2.png) [@Nash](https://discourse.julialang.org/u/Nash)\
**Post date:** [August 5, 2020, 7:43pm UTC](https://discourse.julialang.org/t/implementing-a-keepalive-call-to-betfairs-api/44363/1 "2020-08-05T19:43:28Z")

</div>

I am trying to implement a “keepAlive” call to Betfair’s API and thereby keep my session alive. Unfortunately, I am having some difficulty, and I am hoping that someone here can help me.

(Please see the attached images for information from Betfair’s documentation on keepAlive)

I have attempted the following, but while I get a response, it is not the response I am supposed to get according to the documentation:

```
urlAlive = "https://identitysso.betfair.com/api/keepAlive"
headers = Dict("X-Application" => strip(appKey), "X-Authentication" => strip(sessionToken), "content-type" => "application/json")
body = HTTP.escapeuri(headers)
res = HTTP.request("POST", urlAlive, body=body)

```

I get the following response:

“”"  
HTTP/1.1 200 OK  
P3P: CP=‘IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT’  
Pragma: no-cache  
Cache-Control: no-cache,must-revalidate,no-store  
Expires: Thu, 01 Jan 1970 00:00:00 GMT  
Content-Type: image/png  
Content-Length: 69  
Date: Wed, 05 Aug 2020 19:41:10 GMT  
Content-Security-Policy-Report-Only: default-src ‘unsafe-inline’ ‘unsafe-eval’ data: https: wss:; report-uri [https://shk.betfair.com/csp](https://shk.betfair.com/csp)  
X-XSS-Protection: 1; mode=block![keepAlive\_1|690x351]  
⋮  
69-byte body  
“”"

 ![keepAlive_1](https://global.discourse-cdn.com/julialang/original/3X/0/6/06bbef627dbcf7713b19a97c59df70dfb48e93d4.jpeg)  
 ![keepAlive_2](https://global.discourse-cdn.com/julialang/original/3X/8/9/897dc84f6fb6a54c89de03bc3521c9aaefda8012.jpeg)
