ios Xtify推送api 415在尝试向即时推送发送有效负载时的状态代码



我正在尝试向Xtify 2.0推送api发送有效负载。

我尝试从我的两个iOS应用程序使用这个代码:

- (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];
    }

其中xids是具有一个项目的NSMutableArray。

此外,我还尝试使用Firefox插件REST客户端使用此代码:标题:

Content-type: application/json

数据:

{
    "apiKey": "myapikey",
    "appKey": "myappkey",
    "xids": ["500865a987242167c69b4e6c"], 
    "content": {
        "subject": "Greetings Earthlings",
        "message": "Take me to your leader"
    }
}

(其中我的"myapikey"one_answers"myappkey"被替换为我的应用程序密钥)

方法POST和url"http://api.xtify.com/2.0/push"

在这两种情况下,Xtify都会回复:

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

我做错了什么?

该消息表示您的API密钥不正确或已过期。请确保在Xtify控制台中创建一个高级密钥。

相关内容

  • 没有找到相关文章

最新更新