简体   繁体   English

Bluemix IBM Graph服务-创建顶点

[英]Bluemix IBM Graph service - Create vertices

I am trying to create a vertex using the vertices API. 我正在尝试使用顶点API创建一个顶点。

Please take a look at the following snippet. 请查看以下代码段。

def create_vertex(self,creds,id):
    creds = json.load(open(creds))
    print(creds)
    url = creds['credentials']['apiURL'] + '/vertices'    
    start = time.time()
    res = requests.post(
        url,
        auth=(
            creds['credentials']['username'],
            creds['credentials']['password']
        ),
        data=json.dumps([{"id":"256"}]),
        headers={"Content-Type": "application/json"}
    )

    res.raise_for_status()
    print 'query took %s seconds' % (time.time() - start)
    return res.json()

The curl on the API url is working fine and I received the following response API网址上的curl正常运行,我收到以下响应

{
    "requestId":"49646d73-0073-450a-9976-57049821fa42",
    "status":{
        "message":"",
        "code":200,
        "attributes":{}
    },
    "result":{
        "data":["StandardTitanGraph"],
        "meta":{}
    }
 }

and I guess this response is correct. 我想这个回应是正确的。

But the API URLs are giving me the following errors. 但是API URL给我以下错误。

raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 502 Server Error: Bad Gateway 引发HTTPError(http_error_msg,response = self)request.exceptions.HTTPError:502服务器错误:错误的网关

As Bill mentioned above this issue has been fixed in the latest release of the service. 如上文所述,该问题已在该服务的最新版本中得到解决。 Please try it again and update this Question. 请重试并更新此问题。

In order to get the latest update you will need to create a new service https://console.ng.bluemix.net/catalog/services/graph-data-store/ and run your program against. 为了获取最新更新,您将需要创建一个新服务https://console.ng.bluemix.net/catalog/services/graph-data-store/并对其运行程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM