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 <C_CkRest.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>
void ChilkatSample(void)
{
HCkRest rest;
BOOL success;
BOOL bTls;
int port;
BOOL bAutoReconnect;
HCkStringBuilder sbResponseBody;
HCkJsonObject jsonResponse;
const char *object;
const char *url;
BOOL has_more;
int i;
int count_i;
const char *id;
int created;
const char *filename;
const char *purpose;
int size;
const char *type;
rest = CkRest_Create();
// URL: https://files.stripe.com/v1/files?limit=3
bTls = TRUE;
port = 443;
bAutoReconnect = TRUE;
success = CkRest_Connect(rest,"files.stripe.com",port,bTls,bAutoReconnect);
if (success != TRUE) {
printf("ConnectFailReason: %d\n",CkRest_getConnectFailReason(rest));
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
return;
}
CkRest_SetAuthBasic(rest,"STRIPE_SECRET_KEY","");
sbResponseBody = CkStringBuilder_Create();
success = CkRest_FullRequestNoBodySb(rest,"GET","/v1/files?limit=3",sbResponseBody);
if (success != TRUE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
return;
}
jsonResponse = CkJsonObject_Create();
CkJsonObject_LoadSb(jsonResponse,sbResponseBody);
object = CkJsonObject_stringOf(jsonResponse,"object");
url = CkJsonObject_stringOf(jsonResponse,"url");
has_more = CkJsonObject_BoolOf(jsonResponse,"has_more");
i = 0;
count_i = CkJsonObject_SizeOfArray(jsonResponse,"data");
while (i < count_i) {
CkJsonObject_putI(jsonResponse,i);
id = CkJsonObject_stringOf(jsonResponse,"data[i].id");
object = CkJsonObject_stringOf(jsonResponse,"data[i].object");
created = CkJsonObject_IntOf(jsonResponse,"data[i].created");
filename = CkJsonObject_stringOf(jsonResponse,"data[i].filename");
purpose = CkJsonObject_stringOf(jsonResponse,"data[i].purpose");
size = CkJsonObject_IntOf(jsonResponse,"data[i].size");
type = CkJsonObject_stringOf(jsonResponse,"data[i].type");
url = CkJsonObject_stringOf(jsonResponse,"data[i].url");
i = i + 1;
}
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jsonResponse);
}
{
"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"
}
]
}