Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6563693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:52:47+00:00 2026-05-25T13:52:47+00:00

I have a basecamp account which I’m trying to access via its XML API.

  • 0

I have a basecamp account which I’m trying to access via its XML API.

I have created a NSURL Request with proper header fields.

    NSURL* projectsUrl = [NSURL URLWithString:[self.accountURL stringByAppendingString:@"/projects.xml"]];
    NSMutableURLRequest* projectsRequest = [NSMutableURLRequest requestWithURL:projectsUrl];

    [projectsRequest setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
    [projectsRequest setValue:@"application/xml" forHTTPHeaderField:@"Accept"];

I create a connection and start it.

    NSURLConnection* connection = [[NSURLConnection alloc] initWithRequest:projectsRequest delegate:self];
    [connection start];
    [connection autorelease];

Basecamp uses HTTP basic authentication. So I use a NSCredential object to handle it as below.

-(void) connection:(NSURLConnection*)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge*)authenticationChallenge
{


    if ([authenticationChallenge previousFailureCount] <=2 ) {
        NSURLCredential* basecampCredentials;
        basecampCredentials = [NSURLCredential credentialWithUser:[self username] 
                                                         password:[self password]
                                                      persistence:NSURLCredentialPersistenceNone];
        [[authenticationChallenge sender] useCredential:basecampCredentials forAuthenticationChallenge:authenticationChallenge];
    }else {
        [[authenticationChallenge sender] cancelAuthenticationChallenge:authenticationChallenge];

    }

}

And when I receive data from connection i handle it with these delegates.

-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [[self responseData] appendData: data];
    NSLog(@"I received %@", [self responseData]);

}


-(void) connectionDidFinishLoading:(NSURLConnection*)connection
{
    NSLog(@"I FINALLY received %@", [self responseData]);

    NSXMLParser* parser = [[NSXMLParser alloc] initWithData:[self responseData]];
    [parser setDelegate:self];
    BOOL success = [parser parse];
    if (success) {
        NSLog(@"XML parse success");
    }else {
        NSLog(@"XML parse ERROR");
    }

    [parser autorelease];

}

The problem is even after using right urls, authentication credentials and header fields I get null data in responseData whereas when I try to access the same url with curl I get proper xml response from the basecamp server. I’m new to objective C. Please explain and tell me what else should I set to get this right.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:52:47+00:00Added an answer on May 25, 2026 at 1:52 pm

    Before starting connection ([connection start];) you should initialise property responseData, for example, self.responseData = [[NSMutableData alloc] init];.

    In method - (void)connection:(NSURLConnection *)conn didReceiveResponse:(NSURLResponse *)response you should set the length of that data to zero : [self.responseData setLength:0];

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a post request via ajax using jQuery (for the BaseCamp
I have an xsd (for basecamp xml) that contains <xsd:complexType name=ProjectType> <xsd:sequence> <xsd:element name=announcement
We have a local server with an access database which feeds data to clients
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have had to write my first proper multithreaded coded recently, and realised just how
Tools like BaseCamp, FogBugz & Jira have features where you can send an email
I have an app that has Basecamp-style subdomains, that is, I have Projects, Users,
Have created simple Ajax enabled contact forms before that have around 12 fields -
We have an application which is multi-tenant (lots of users all accessing their own
I have separate models for Devise users and admins. I am also using Basecamp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.