-5

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"
garnp
  • 1
  • What have you tried? How are you trying to replace curl in objective-c code? Are you using a library? Do you know what -i and -u do? What have you attempted to replace their invocations? Your question lacks all of this information. – Geoffrey Wiseman May 12 '16 at 20:00
  • Possible duplicate of [Converting a CURL command for Objective C](http://stackoverflow.com/questions/8982707/converting-a-curl-command-for-objective-c) – Utsav Dusad May 12 '16 at 21:01

2 Answers2

0

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.

zaph
  • 111,848
  • 21
  • 189
  • 228
0
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);
MikeT
  • 51,415
  • 16
  • 49
  • 68
Satish Babariya
  • 3,062
  • 1
  • 15
  • 29