Library OpenApi Overview About these APIs Architecture Authentication Error Responses Locating a Server Sessions Design Guides Guides and Hints Examples Pricing for Websites Accepting Vouchers PreAuth Payment Replication Common Apis The most used APIs Create New Sale Payment Completion Multiple Locations Delivery Addresses Create New Sale v2 Customers Locations Products Staff WebHooks eCommerce Apis These APIs are often used with eCommerce website integrations Get Pricing Card Inquiry Report & Analysis Grouped or analysed report data. Typically used to build reports and dashboards Today Login Access Pinboard ReportRequest Advanced Information More indepth information Caller Handling HTTP Protocol Bulk Data Downloads Document Uploading RetailConfig Under Development Details of APIs that will be available shortly. Documentation provided is for early adopters Get Receipt

SalesSearch Examples

Listing Sales using MFC and C++

List all currently parked sales, which is phase=5, created after 1-Jan-2020


// Create the request URL
char* MyRmSystem = "1_2_3_4";
char targetUrl[1000];
sprintf_s(targetUrl, "/OpenApi2_%s/SalesSearch?querytext=phase(5)&after=1-Jan-2020", MyRmSystem);

// Prepare a connection
CInternetSession sess;
CHttpConnection* pHttp = sess.GetHttpConnection("fieldpine.com", 0, (short)443);

const char* Accept[2] = { "application/json", NULL };
DWORD SessFlags = INTERNET_FLAG_SECURE;
CHttpFile* pRf = pHttp->OpenRequest("GET", targetUrl, NULL, 1, (const char**)Accept, NULL, SessFlags);

pRf->AddRequestHeaders("X-Api-Key: YOUR-KEY-GOES-HERE\r\n", HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);

pRf->SendRequest(NULL, 0, NULL, 0);
DWORD Status = 0;
pRf->QueryInfoStatusCode(Status);

// Read Content regardless of status
CString ct;
pRf->QueryInfo(HTTP_QUERY_CONTENT_LENGTH, ct);
long ContentLength = atol(ct);

CString ReplyString;
if (ContentLength > 0) {
	unsigned char bb[8192*4];
	int rl = pRf->Read(bb, sizeof(bb));
	while (rl > 0) {
		ContentLength -= rl;
		ReplyString += CString(bb, rl);
		
		if (ContentLength > 0) {
			rl = pRf->Read(bb, sizeof(bb));
		} else rl = 0;
	}
}


if ((Status >= 200) && (Status <= 299)) {
    // Process ReplyString here - it contains the server response
}

// Cleanup...