Live-Score-Api

FREEMIUM
Durch Live Score API | Aktualisiert 16日前 | Sports
Popularität

2.2 / 10

Latenz

558ms

Service Level

100%

Health Check

N/A

Zurück zu allen Diskussionen

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.

Nehmen Sie an der Diskussion teil - fügen Sie unten einen Kommentar hinzu:

Anmelden / Registrieren, um neue Kommentare zu veröffentlichen