•   over 5 years ago

Put Request Not working in Sandbox API

I'm trying to change the status of a Request I make using the Sandbox API and am getting the following error when I make my put request:

{"message":"Method not supported for this endpoint.","code":"method_not_allowed"}

I'm using Objective-C, Below is the code I'm using to make the PUT request, any help would be great!

NSString *url = [NSString stringWithFormat:@"https://sandbox-api.uber.com/v1/requests/%@?access_token=%@", _requestId, _perma_access_token];

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];

[request setHTTPMethod:@"PUT"];

[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];

NSDictionary* requestDictionary = @{@"status" : @"accepted"};

[request setHTTPBody:[NSJSONSerialization dataWithJSONObject:requestDictionary options:NSJSONWritingPrettyPrinted error:nil]];

NSURLResponse *response = nil;

NSError *error = nil;

NSData *requestData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

Comments are closed.