我尝试使用REST add.jag添加API。在1.9.1和1.10.0上都尝试过。在仪表板UI中,它添加正常,但显示以下消息
Status code: 200
{
"message": " null",
"error": true
}
日志文件显示
[2016-01-10 16:21:22,956] ERROR {JAGGERY.site.blocks.item-add.ajax.add:jag} - java.lang.NullPointerException: null {JAGGERY.site.blocks.item-add.ajax.add:jag}
我在CURL和Python中运行它,得到相同的错误。 这是我发送给REST的正文:
body = {
"action" : "addAPI",
"name" : "employee",
"context" : "/employee",
"version=" : "1.0.0",
"visibility" : "public",
"description" : "list employees",
"endpointType" : "nonsecured",
"http_checked" : "http",
"https_checked" : "https",
"tier" : "Unlimited",
"tiersCollection" : "Unlimited,Silver",
"environments" : "Production",
"resourceCount" : "0",
"resourceMethod-0" : "GET",
"resourceMethodAuthType-0" : "Application",
"resourceMethodThrottlingTier-0" : "Unlimited",
"endpointConfig" : '{"production_endpoints":{"url":"http://localhost:8080/sample2/api/company/employees","config":null},"endpoint_type":"http"}'
"endpointType" : "nonsecured"
}
答案 0 :(得分:0)
好的让它发挥作用。 以下是更新的身体参数集 似乎缺少的是uriTemplate-0。
body
{
"action" : "addAPI",
"name" : "employee",
"context" : "/employee",
"version" : "1.0.0",
"visibility" : "public",
"thumburl" : "",
"description" : "list employees",
"tags" : "company,employees",
"endpointType" : "nonsecured",
"tiersCollection" : "Gold,Silver",
"http_checked" : "http",
"https_checked" : "https",
"bizOwner" : "xx",
"bizOwnerMail" : "xx@ee.com",
"techOwner" : "xx",
"techOwnerMail" : "xx@ee.com",
'resourceCount': '0',
'resourceMethod-0': 'GET',
"resourceMethodAuthType-0" : "Application",
'resourceMethodThrottlingTier-0': 'Unlimited',
"uriTemplate-0" : "/*",
'default_version_checked': 'default_version',
'endpoint_config': '{"production_endpoints":{"url":"http://ws.cdyne.com/phoneverify/phoneverify.asmx","config":null},"endpoint_type":"http"}'
}