Live-Score-Api

FREEMIUM
By Live Score API | Updated לפני 4 ימים | Sports
Popularity

2.4 / 10

Latency

500ms

Service Level

100%

Health Check

N/A

Back to All Discussions

Incomplete JSON response

Rapid account: Rakeshcv
rakeshcv
לפני 10 שנים

When ever I make a request I get the following response…

{
status:“not completed”
}

Rapid account: Cloudsight
cloudsight Commented לפני 10 שנים

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.

Rapid account: Rakeshcv
rakeshcv Commented לפני 10 שנים

I get the correct result when I use the token [returned from the request] in the Mashape.com [EndPoint],

Rapid account: Cloudsight
cloudsight Commented לפני 10 שנים

Can you reply with the complete URL you’re using to check for a response?

Rapid account: Rakeshcv
rakeshcv Commented לפני 10 שנים
Rapid account: Rakeshcv
rakeshcv Commented לפני 10 שנים

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??

Rapid account: Cloudsight
cloudsight Commented לפני 10 שנים

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…

Rapid account: Cloudsight
cloudsight Commented לפני 10 שנים

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).

Rapid account: Cloudsight
cloudsight Commented לפני 10 שנים

Code from last message wasn’t formatted correctly:

static NSString *kISBaseUrl = @"https://camfind.p.mashape.com/image_responses/%@";
NSString *requestUrl = [NSString stringWithFormat:kISBaseUrl, token];
UNIHTTPJsonResponse* response = [[UNIRest get:^(UNISimpleRequest* request) {
  [request setUrl:requestUrl];
  [request setHeaders:headers];
  [request setParameters:parameters];
}] asJson];
Rapid account: Rakeshcv
rakeshcv Commented לפני 10 שנים

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.

Rapid account: Rakeshcv
rakeshcv Commented לפני 10 שנים

Sure.Am having some problem with my mac so waiting for the fix.

Join in the discussion - add comment below:

Login / Signup to post new comments