Crowdsourcing Example
Helps improve match rates on an ongoing basis
In order to call the /crowdsourcing endpoint, and report user feedback (see Overview):
Required Fields
In the /merchant/list and /merchant endpoints, the X-Request-Id and X-Timestamp headers are returned. In order to submit a crowdsourcing request, you must store these values and send them in the requestId and requestTimstamp fields. If the report is in relation to a transaction in a /merchant/list request, you must also include the transactionId field of that transaction.
More on this in the OpenAPI spec.
curl --request POST
--url https://regional-snowdrop-domain-goes-here.com/api/v3/crowdsourcing
--header 'Content-Type: application/json'
--header 'X-Api-Key: <YOUR-API-KEY>'
--data '{ "requestId": "1234abcd-1234-1234-1234-1234567890abc", "requestTimestamp": 1663766866877, "transactionId": "1234x1234", "wrongFields": [ "name", "address", "img" ], "suggestions": { "name": "McDonalds", "address":"10 Downing Street", "img": "new_logo.url" } }'
import http.client
conn = http.client.HTTPSConnection("regional-snowdrop-domain-goes-here.com")
payload = "{"requestId": "1234abcd-1234-1234-1234-1234567890abc","requestTimestamp": 1663766866877,"transactionId": "218x09d","wrongFields": ["name","address","img"],"suggestions": {"name": "McDonalds","address":"10 Downing Street","img": "new_logo.url"}}"
headers = { 'Content-Type': "application/json", 'X-Api-Key': "<YOUR-API-KEY>" }
conn.request("POST", "/api/v3/crowdsourcing", payload, headers)
res = conn.getresponse() data = res.read()
print(data.decode("utf-8"))
var client = new RestClient("https://regional-snowdrop-domain-goes-here.com/api/v3/crowdsourcing");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json"); request.AddHeader("X-Api-Key", "<YOUR-API-KEY>"); request.AddParameter("application/json", "{"requestId": "1234abcd-1234-1234-1234-1234567890abc","requestTimestamp": 1663766866877,"transactionId": "218x09d","wrongFields": ["name","address","img"],"suggestions": {"name": "McDonalds","address":"10 Downing Street","img": "new_logo.url"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
const data = JSON.stringify({ "requestId": "1234abcd-1234-1234-1234-1234567890abc", "requestTimestamp": 1663766866877, "transactionId": "218x09d", "wrongFields": [ "name", "address", "img" ], "suggestions": { "name": "McDonalds", "address": "10 Downing Street", "img": "new_logo.url" } });
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://regional-snowdrop-domain-goes-here.com/api/v3/crowdsourcing");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("X-Api-Key", "<YOUR-API-KEY>");
xhr.send(data);
HttpResponse response = Unirest.post("https://regional-snowdrop-domain-goes-here.com/api/v3/crowdsourcing") .header("Content-Type", "application/json") .header("X-Api-Key", "<YOUR-API-KEY>") .body("{"requestId": "1234abcd-1234-1234-1234-1234567890abc","requestTimestamp": 1663766866877,"transactionId": "218x09d","wrongFields": ["name","address","img"],"suggestions": {"name": "McDonalds","address":"10 Downing Street","img": "new_logo.url"}}") .asString();
Response
If you supplied the required fields correctly, you should recieve a success message:
{
"message": "Report created"
}Having problems? Consult Troubleshooting or FAQ.
Last updated
Was this helpful?