I'm trying to convert this cURL command to objective-c but can't find any information on "-i" and "-u" with regards to objective-c libraries.
curl -i -u "username" "https:domain.com/v1/authenticate"
I'm trying to convert this cURL command to objective-c but can't find any information on "-i" and "-u" with regards to objective-c libraries.
curl -i -u "username" "https:domain.com/v1/authenticate"
Google "man curl", gee that was easier than creating a SO question.
-i
(HTTP) Include the HTTP-header in the output. The HTTP-header includes things like server-name, date of the document, HTTP- version and more...-u
Specify the user name and password to use for server authentica- tion.
curl -X GET
--header "Accept: application/json"
--header "app_id: 999999"
--header "app_key: xxxxxxx"
--header "Dev-Mode: true" "https://api.infermedica.com/v2/symptoms"
Objective-C code
(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//CURL
//curl -X GET --header "Accept: application/json" --header "app_id: 795edb00" --header "app_key: c68cb95e54ec04f44544bb5fd7ab5125" --header "ev-Mode: true" "https://api.infermedica.com/v2/symptoms"
NSString *str = [NSString stringWithFormat:@"https://api.infermedica.com/v2/symptoms;app_id=795edb00;app_key=c68cb95e54ec04f44544bb5fd7ab5125"];
NSURL *url = [[NSURL alloc]initWithString:str];
NSData *data = [[NSData alloc ]initWithContentsOfURL:url];
arr = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
NSLog(@"%@",arr);