Note: Metadata Discover API is a standalone product. If you're interested in activating this feature, please reach out to your Metadata rep.
Unveil anonymous website visitors and get firmographic details so that you can provide them with a more personalized experience.
Call the API
- Perform a GET request here: https://api-gw.metadata.io/ip-translation
- Include these headers:
- Authorization: {API KEY}
- Referer: {DOMAIN}
Sample response
{ "ip":"1.1.1.1", "domain":"jccomp.com", "name":"Jccomp", "employees":"50 - 199", "revenue":"$10M - $50M", "industries":[ "Medical Device" ], "location":{ "country":"United States", "state":"CA", "city":"Winters", "zip":"95694", "address":"103 Orchard Ln" }, "confidenceScore":0.83 }
Example implementation using JavaScript (front-end)
(function() { function verifySessionStorage() { try { var t = "__ss_test__"; window.sessionStorage.setItem(t, t); window.sessionStorage.removeItem(t); return true; } catch (e) { return false; } } var metadata_data = null; var isSessionStorageAvailable = verifySessionStorage(); if (isSessionStorageAvailable) { metadata_data = window.localStorage.getItem("custom_vars_data"); } if (isSessionStorageAvailable && metadata_data === null) { var url = "https://api-gw.metadata.io/ip-translation"; var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.setRequestHeader("Authorization", "{API TOKEN GOES HERE}"); xhr.onload = function() { if (xhr.readyState == xhr.DONE) { if (xhr.status === 200) { var custom_vars = {}; var response = xhr.response; window.sessionStorage.setItem("custom_vars_data", response); window.localStorage.setItem("custom_vars_data", response); } else if (xhr.status !== 200) { console.log("Error", err); } } }; xhr.send(); }else{ window.sessionStorage.setItem("custom_vars_data", metadata_data); } })();
Grab the company name from session storage to use somewhere on your website:
JSON.parse(sessionStorage.getItem("custom_vars_data")).name;
Example using cURL
curl --location 'https://api-gw.metadata.io/ip-translation' \ --header 'Authorization: {API TOKEN}' \ --header 'Referer: {DOMAIN NAME}'
Perform test API calls
The API endpoint accepts "ip" as a query parameter which can be used to perform some test calls using a specific IP. For example: https://api-gw.metadata.io/ip-translation?ip=1.1.1.1
Comments
0 comments
Article is closed for comments.