卷发命令在推送发送中不起作用

时间:2016-06-06 10:34:02

标签: angularjs curl ionic-framework

您好我正在创建应用程序,其中将实施推送通知,但是在4时>发送推送下面的命令行给出错误。 以下是我的个人资料信息 DEV_DEVICE_TOKEN:您从应用中复制的日志= DEV-8423e4fd-f7fa-4bfd-b56b-f904dfc8035a

PROFILE_NAME:您的安全档案名称=个人资料

API_TOKEN:您创建的API令牌= eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3MmI2MTkyMy0zOTA4LTRhNDQtOWNhMC1hMjNhMzQ0ODM4ZGQifQ.1XVYY3Cf5F8NJ9qmcHz4Xxk6MZU_DZSKXzGQUcSFExo

curl -X POST -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3MmI2MTkyMy0zOTA4LTRhNDQtOWNhMC1hMjNhMzQ0ODM4ZGQifQ.1XVYY3Cf5F8NJ9qmcHz4Xxk6MZU_DZSKXzGQUcSFExo" -H "Content-Type: application/json" -d '{
    "tokens": ["DEV-8423e4fd-f7fa-4bfd-b56b-f904dfc8035a"],
    "profile": "profile",
    "notification": {
        "message": "This is my demo push!"
    }
}' "https://api.ionic.io/push/notifications"

这是我得到的错误

C:\Users\lenovo>curl -X POST -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3MmI2MTkyMy0zOTA4LTRhNDQtOWNhMC1hMjNh
MzQ0ODM4ZGQifQ.1XVYY3Cf5F8NJ9qmcHz4Xxk6MZU_DZSKXzGQUcSFExo" -H "Content-Type: application/json" -d '{
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information

C:\Users\lenovo>    "tokens": ["DEV-8423e4fd-f7fa-4bfd-b56b-f904dfc8035a"],
'"tokens":' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\lenovo>    "profile": "profile",
'"profile":' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\lenovo>    "notification": {
'"notification":' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\lenovo>        "message": "This is my demo push!"
'"message":' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\lenovo>    }
'}' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\lenovo>}' "https://api.ionic.io/push/notifications"

我的其他curl命令正在运行它意味着我的crul正在工作 但为此它显示此错误 如何解决这个问题

1 个答案:

答案 0 :(得分:1)

shell将每一行解释为一个新命令。

将所有命令组合成一行,或者在每行的末尾放置一个\,让shell知道命令没有完成,如下所示:

    curl -X POST -H "Authorization: <snip>" -H "Content-Type: application/json" -d '{ \
        "tokens": ["<snip>"], \
        "profile": "profile", \
        "notification": { \
            "message": "This is my demo push!" \
        } \
    }' "https://api.ionic.io/push/notifications"

此外,如果您的真实身份信息需要更改,就像其他人可能会使用它一样!

编辑:在Windows上,放在每行末尾的字符为^,所以它应该是:

    curl -X POST -H "Authorization: <snip>" -H "Content-Type: application/json" -d '{ ^
        "tokens": ["<snip>"], ^
        "profile": "profile", ^
        "notification": { ^
            "message": "This is my demo push!" ^
        } ^
    }' "https://api.ionic.io/push/notifications"

希望这有帮助!

相关问题