When ever I make a request I get the following response…
{ status:“not completed” }
That simply means the tag hasn’t yet been returned for the token supplied or that the token doesn’t exist. Make sure the token is correct and the image was submitted successfully.
I get the correct result when I use the token [returned from the request] in the Mashape.com [EndPoint],
Can you reply with the complete URL you’re using to check for a response?
https://www.mashape.com/imagesearcher/camfind#!endpoint-2-Image-Response
Token Value - P2uAnWLHPSYTVyIJqdQApw
NSLog(@“Output = %@”, json.isArray ? json.JSONArray : json.JSONObject);
NSString *token =[json.JSONObject objectForKey:@"token"]; NSDictionary* parameters = [NSDictionary dictionaryWithObjectsAndKeys:nil]; // And the headers NSDictionary* headers = [NSDictionary dictionaryWithObjectsAndKeys:@" hiding the API key", @"X-Mashape-Authorization", nil]; UNIHTTPJsonResponse* response = [[UNIRest get:^(UNISimpleRequest* request) { [request setUrl:@"https://camfind.p.mashape.com/image_responses/token"]; [request setHeaders:headers]; [request setParameters:parameters]; }] asJson]; NSLog(@"The HTTP status code is %d", [response code]); NSLog(@"The HTTP headers are %@", [response headers]); NSLog(@"The HTTP parsed body is %@", [response body]); NSLog(@"The HTTP raw body is %@", [response rawBody]);
Here you go. Can u find anything wrong??
Ok, so the URL you should use to retrieve the response for the token “P2uAnWLHPSYTVyIJqdQApw” would be:
https://camfind.p.mashape.com/image_responses/P2uAnWLHPSYTVyIJqdQApw
And, of course, make sure you include the authentication headers too…
I would recommend declaring a static URL before the @implementation line as follows:
static NSString *kISBaseUrl = @"https://camfind.p.mashape.com/image_responses/%@";
And then further down in the code where you have the [UNIRest get:…] call:
NSString *requestUrl = [NSString stringWithFormat:kISBaseUrl, token]; UNIHTTPJsonResponse* response = [[UNIRest get:^(UNISimpleRequest* request) { [request setUrl:requestUrl]; [request setHeaders:headers]; [request setParameters:parameters]; }] asJson];
Note, the difference is that we’re appending the token as part of the URL. The problem is, you’re not passing any token at all since the URL you’re requesting is https://camfind.p.mashape.com/image_responses/token/ instead of https://camfind.p.mashape.com/image_responses/[token] (where [token] is the token of the image response to return).
Code from last message wasn’t formatted correctly:
Actually am passing the token I have another method where all the image response take place.Anyway I will try the above code and let u know.
Sure.Am having some problem with my mac so waiting for the fix.
Join in the discussion - add comment below:
That simply means the tag hasn’t yet been returned for the token supplied or that the token doesn’t exist. Make sure the token is correct and the image was submitted successfully.
I get the correct result when I use the token [returned from the request] in the Mashape.com [EndPoint],
Can you reply with the complete URL you’re using to check for a response?
https://www.mashape.com/imagesearcher/camfind#!endpoint-2-Image-Response
Token Value - P2uAnWLHPSYTVyIJqdQApw
NSLog(@“Output = %@”, json.isArray ? json.JSONArray : json.JSONObject);
Here you go. Can u find anything wrong??
Ok, so the URL you should use to retrieve the response for the token “P2uAnWLHPSYTVyIJqdQApw” would be:
https://camfind.p.mashape.com/image_responses/P2uAnWLHPSYTVyIJqdQApw
And, of course, make sure you include the authentication headers too…
I would recommend declaring a static URL before the @implementation line as follows:
And then further down in the code where you have the [UNIRest get:…] call:
Note, the difference is that we’re appending the token as part of the URL. The problem is, you’re not passing any token at all since the URL you’re requesting is https://camfind.p.mashape.com/image_responses/token/ instead of https://camfind.p.mashape.com/image_responses/[token] (where [token] is the token of the image response to return).
Code from last message wasn’t formatted correctly:
Actually am passing the token I have another method where all the image response take place.Anyway I will try the above code and let u know.
Sure.Am having some problem with my mac so waiting for the fix.