Returns a list of the files that you have uploaded to Stripe. The file uploads are returned sorted by creation date, with the most recently created file uploads appearing first.
curl https://files.stripe.com/v1/files?limit=3 \
-u STRIPE_SECRET_KEY: \
-G
#include <CkRestW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
CkRestW rest;
bool success;
// URL: https://files.stripe.com/v1/files?limit=3
bool bTls = true;
int port = 443;
bool bAutoReconnect = true;
success = rest.Connect(L"files.stripe.com",port,bTls,bAutoReconnect);
if (success != true) {
wprintf(L"ConnectFailReason: %d\n",rest.get_ConnectFailReason());
wprintf(L"%s\n",rest.lastErrorText());
return;
}
rest.SetAuthBasic(L"STRIPE_SECRET_KEY",L"");
CkStringBuilderW sbResponseBody;
success = rest.FullRequestNoBodySb(L"GET",L"/v1/files?limit=3",sbResponseBody);
if (success != true) {
wprintf(L"%s\n",rest.lastErrorText());
return;
}
CkJsonObjectW jsonResponse;
jsonResponse.LoadSb(sbResponseBody);
const wchar_t *object = 0;
const wchar_t *url = 0;
bool has_more;
int i;
int count_i;
const wchar_t *id = 0;
int created;
const wchar_t *filename = 0;
const wchar_t *purpose = 0;
int size;
const wchar_t *type = 0;
object = jsonResponse.stringOf(L"object");
url = jsonResponse.stringOf(L"url");
has_more = jsonResponse.BoolOf(L"has_more");
i = 0;
count_i = jsonResponse.SizeOfArray(L"data");
while (i < count_i) {
jsonResponse.put_I(i);
id = jsonResponse.stringOf(L"data[i].id");
object = jsonResponse.stringOf(L"data[i].object");
created = jsonResponse.IntOf(L"data[i].created");
filename = jsonResponse.stringOf(L"data[i].filename");
purpose = jsonResponse.stringOf(L"data[i].purpose");
size = jsonResponse.IntOf(L"data[i].size");
type = jsonResponse.stringOf(L"data[i].type");
url = jsonResponse.stringOf(L"data[i].url");
i = i + 1;
}
}
{
"object": "list",
"url": "/v1/files",
"has_more": false,
"data": [
{
"id": "file_1BnEEuGswQrCoh0XqB3XkqAg",
"object": "file_upload",
"created": 1516661888,
"filename": "path",
"purpose": "sigma_scheduled_query",
"size": 500,
"type": "csv",
"url": "https://stripe-upload-api.s3.amazonaws.com/uploads/file_1BnEEuGswQrCoh0XqB3XkqAg?AWSAccessKeyId=KEY_ID\u0026Expires=TIMESTAMP\u0026Signature=SIGNATURE"
}
]
}