amidb
APIs / Basics/↴
Authentication
AmiDb follows a multi tenant paradigm enabling developers to think on data separation right from the start. Most APIs require the below parameters or a subset of them to be sent as header or query parameters
Header/Query parameters Explanation
XGGUTC UTC Time stamp in milliseconds. E.g. 1469293176987 (13 digits) This time must be less than 30 minutes of current time. Please ensure your servers report correct time values.
XGGUSR Your username
XGGCID
(optional when not tenant scoped)
When you have users you ideally want them to be scoped to a particular container.
Examples of containers can be a Store, a Site, a Product Name, ZIP code, or any string.
XGGTID (optional) These can be any string but you may end up using the email addresses of your users. Note: You must provide a containerId when you provide the tenant.
XGGSGN Your developer key is present under "Developer Keys" menu item. Do not share this with anyone. Sign the utc+username value with the developer key to generate the signature.

Sample Code

"data" is utc+youremail that you used to login to this website. "developerkey" is available under "Developer Keys" menu item. You can use any programming language to generate signature. Below is a Java sample. import java.security.SignatureException; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import javax.xml.bind.DatatypeConverter; public class Signature{ private final String HmacSHA256 = "HmacSHA256"; public String calculateSignature(String data, String developerkey) throws java.security.SignatureException{ String result = null; Mac mac = Mac.getInstance(HmacSHA256); SecretKeySpec signingKey = new SecretKeySpec(developerkey.getBytes("UTF8"), HmacSHA256); mac.init(signingKey); byte[] rawHmac = mac.doFinal(data.getBytes("UTF8")); result = DatatypeConverter.printBase64Binary(rawHmac); return result; } }