松弛上传:尝试使用Curl上传时出错 [英] Slack Upload : Error while trying to upload using Curl

查看:165
本文介绍了松弛上传:尝试使用Curl上传时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用我从此处了解的curl命令上传本地文件
,但是在尝试运行命令时,它不起作用并引发错误:

I am trying to upload a local file using curl command which I got to know about from here but while trying to run the command, It is not working and throwing error:

{"ok":false,"error":"not_authed"}

我正在运行的命令是:

curl -F file=testsend.txt -F channels=#channel -F token='token' -F filetype=post https://slack.com/api/files.upload


推荐答案

根据收到的错误消息,您正在使用的访问令牌不是合法的。请仔细检查您是否使用了有效的访问令牌,应该看起来像这样:

According to the error message you got, the access token you are using does not seam to be valid. Please double-check that you are using a valid access token, should look something like this:

-F token='xoxo-123456789-123456789'

我假设您没有使用'token'作为访问令牌。显然这行不通。

I am assuming you did not use 'token' as access token. That would obviously not work.

要获取您想要创建Slack应用并将其安装到工作场所的访问令牌(请参见文档此处),也可以获取旧版令牌用于测试。

to get an access token you want to create a Slack app and install it to your workplace (see documentation here), or you can get a legacy token for test purposes.

还要确保您的访问令牌具有上传文件所需的权限,例如 files:write:user

Also make sure your access token has the needed permissions for uploading files, e.g. files:write:user

这篇关于松弛上传:尝试使用Curl上传时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆