如何在WSO2中使用1.6.0版本的CURL向API Manager组件中的API Publisher添加API



当我执行curl请求在api Manager-Publisher中发布api时,它显示它已添加…但无法改变它的状态…! !也不能打开那个API !!

My Request:

curl -X POST -b cookies  http://my.api-site.com:9763/publisher/site/blocks/item-add/ajax/add.jag 
 -d "action=addAPI&name=TwitterAPI&context=/twitter&version=1.0.0&tier=Bronze&tier=Gold&transports=http&http_checked=http&transports=https&https_checked=https&description=Twitter&visibility=public API&tags=twitter,api&resourceCount=0&resourceMethod-0=GET,PUT,POST,DELETE,OPTIONS&resourceMethodAuthType-0=Application & Application User,Application & Application User,Application & Application User,Application & Application User,None&uriTemplate-0=/*&resourceMethodThrottlingTier-0=Unlimited, Unlimited, Unlimited, Unlimited, Unlimited&tiersCollection=Bronze,Gold,Silver,Unlimited" 
 -d 'endpoint_config={"production_endpoints":{"url":"http://search.twitter.com","config":null},"endpoint_type":"http"}'
响应:

{"error" : true, "message" : " null"}

有人能帮忙吗?

参数以key1=value1&key2=value2...格式在curl中传递。因此,如果key1, key2, value1, value2包含任何特殊字符,如=, &, ?,则应进行unlencoded。

你的问题是这个参数:

resourceMethodAuthType-0=Application & Application User,Application & Application User,Application & Application User,Application & Application User,None

你的值中有很多&字符。应该是urlencoded。例如这个&应该替换为%26,所以字符串将是:

resourceMethodAuthType-0=Application %26 Application User,Application %26 Application User,Application %26 Application User,Application %26 Application User,None

另一件事,如果你从windows运行命令,总是使用双引号,而不是单引号。例如:

-d "endpoint_config={"production_endpoints"...}"

相关内容

  • 没有找到相关文章

最新更新