API Calls - xamoom/xamoom-ios-sdk GitHub Wiki
All xamoom APIs follow the json:api convetions. These shared conventions, increase productivity, take advantage of generalized tooling. Before getting started with our API you should inform yourself about these conventions at jsonapi.org. After you've done that keep on reading about how the xamoom API is structured and how we implemented these conventions for different use cases.
If you finished reading in our API concepts, it's time to learn how to use the XMMEnduserApi and how to handle calls to our backend. If you not know what XMMEnduserApi is, read in our Getting started guide.
Make your first call
let api = XMMEnduserApi(apiKey: "API-KEY")
api.system(completion: { (system, error) in
if let error == error {
print("Error: \(error)")
} else if let system = system {
print("System name: \(system.name)")
}
})
XMMEnduserApi functions, handle the api call results with completions. These completions always have a result, an error and additional parameters in multiple cases. All of them are optional, so please implement a null check to avoid NullPointerExceptions.
Never hardcode ids!
This is very important! Never ever hardcode any Id in your application. Not even the one of your system. Always use your API key to get your system, without id and from there on use the relationships to get objects like Style or Settings. Also never hardcode Content Ids, always query for them by tags or use location identifiers to get content that is connected to a place or object. This will make your life a lot easier and it makes your solution a lot more flexible.
For a more details read the API Model Specification.