Curl Response - Contents

I am trying to build a curl solution to run through each record in my db and get a refresh token, the response is coming back for the first record in getContent() correctly. The second record runs and I do get back a refresh token but the response in getContent() now has two improperly formatted JSON properties without a comma separating them. I was expecting a single json property not a concatenated response. the portion of code for the “contents” response is

ce.SetOpt(“FILE”,cf_1)

ce.Exec()
dim headers as c
dim contents as c
headers = cf_1.GetHeaders()
contents = cf_1.GetContent()

first record processed returns this from the API in cf_1.GetContent()
{
“access_token”: “EAAp7Yg”,
“token_type”: “bearer”,
“expires_at”: “2022-11-03T02:24:03Z”,
“merchant_id”: “DBHE1”,
“refresh_token”: “EQANmLy”,
“short_lived”: false
}​

The second record processed returns this from the API in cf_1.GetContent()

{
“access_token”: “EAAp7Yg”,
“token_type”: “bearer”,
“expires_at”: “2022-11-03T02:24:03Z”,
“merchant_id”: “DBHE1”,
“refresh_token”: “EQANmLy”,
“short_lived”: false
}​​{
“access_token”: “EAAgucp”,
“token_type”: “bearer”,
“expires_at”: “2022-11-03T02:56:25Z”,
“merchant_id”: “FSTK6”,
“refresh_token”: “EQAAgbC”,
“short_lived”: false
}​

I would think the response should be cleared in curl not concatenated to include both but even so I would think it would at least have the expected comma between them. So I am getting the correct info back, I just wonder why the connection is retaining the contents from the call and is this something that can be fixed on squares end when using curl with the API. I have tried to close the curl connection after receiving the first response but the values persist.

Any thoughts would be appreciated!

Using curl/7.81.0 if that helps

Not sure how much we can help here. The refresh token is stored in your DB and we don’t really have any knowledge on how it’s stored. :slightly_smiling_face:

I figured out the issue, nothing to do with square: I needed to clear the curl memory stream using cf_1.clear() between calls as cf_1.GetContent() gets it’s value from memory. So no square issue, more with curl and my implementation

Awesome! Glad to hear you figured it out. :slightly_smiling_face: