I'm trying to send an payload to Xtify 2.0 push api.
I tried from both my iOS app using this code :
- (void)sendPushToXids:(NSMutableArray *)xids {
ASIFormDataRequest *req = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:xtifyPushUrl]];
req.requestMethod = @"POST";
[req setPostValue:xAppKey forKey:@"appKey"];
[req setPostValue:xApiKey forKey:@"apiKey"];
[req setPostValue:xids forKey:@"xids"];
NSMutableDictionary *contentDict = [[NSMutableDictionary alloc] init];
[contentDict setObject:@"This is a message" forKey:@"message"];
[contentDict setObject:@"default.caf" forKey:@"sound"];
[req setPostValue:contentDict forKey:@"content"];
req.delegate = self;
[req startAsynchronous];
}
where xids is a NSMutableArray with one item.
Also i tried using this code using Firefox plugin REST Client: Header:
Content-type: application/json
Data:
{
"apiKey": "myapikey",
"appKey": "myappkey",
"xids": ["500865a987242167c69b4e6c"],
"content": {
"subject": "Greetings Earthlings",
"message": "Take me to your leader"
}
}
(where my "myapikey" and "myappkey" are replaced with my app keys)
with method POST and url "http://api.xtify.com/2.0/push"
In both cases Xtify responds with :
HTTP Status 415 - Unsupported Media Type
type Status report
message Unsupported Media Type
description The server refused this request because the request entity is in a format not supported by the requested resource for the requested method (Unsupported Media Type).
What am I doing wrong?
That message means your API key is not correct or expired. Make sure to create an advanced key in the Xtify console.