Live-Score-Api

फ्रीमियम
द्वारा Live Score API | अपडेट किया गया 4 days ago | Sports
लोकप्रियता

2.4 / 10

लेटेंसी

500ms

सेवा का स्तर

100%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

Incomplete JSON response

Rapid account: Rakeshcv
rakeshcv
10 years ago

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

{
status:“not completed”
}

Rapid account: Cloudsight
cloudsight Commented 10 years ago

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 years ago

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 years ago

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

Rapid account: Rakeshcv
rakeshcv Commented 10 years ago
Rapid account: Rakeshcv
rakeshcv Commented 10 years ago

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 years ago

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 years ago

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 years ago

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 years ago

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 years ago

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

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें