In an earlier post I had mentioned that I have decided what my next app will be – the iSifterApp. Based on the API methods exposed by sifterapp.com, I have started designing the app. At this time, the API only allows read access to the projects. Essentially the API retrieves the following information:
- Related to Project: Project Listing and Detail, People, Milestones and Categories.
- Related to Issues: Issue Listing and Detail
Issue detail includes comments as well.
The example requests listed in the API documentation are all curl commands. Such as:
curl -H 'X-Sifter-Token: 343b1b831066a40e308e0af92e0f06f0' \ -H 'Accept: application/json' \ 'https://example.sifterapp.com/api/projects/189113590/issues/46809840'
I have not used curl before. I was not even aware that http requests could have headers! I had created iPhone Apps using NSURLRequest, but that class had no methods for adding headers to the call. I was a bit worried, but I did not have to be. A quick google search revealed NSMutableURLRequest. It was the perfect solution. It had a method called addValue:forHTTPHeaderField. Very convenient.
I opened xcode, edited an old project that had an NSURLRequest request in it and modified it. I changed the NSURLRequest to NSMutableURLRequest, added
[request addValue:@"6ac33952asdfe43asc013f7755adf3decbf2afba55" forHTTPHeaderField:@"X-Sifter-Token"];
[request addValue:@"application/json" forHTTPHeaderField:@"Accept"];
and for the address
NSString *address = [ NSString stringWithFormat:@"https://lookitup4me.sifterapp.com/api/projects%@", @"" ];
and executed it.
In an instant, I got the response. I validated the output at http://json.parser.online.fr/, and it showed me all the right information nicely formatted.
I had already started on the design. But with this request with header and access key validated, I am confident that I can proceed with the coding. Here is one of the main screens in iSifterApp, which I will explain in subsequent posts.