Bluemix IBM Graph服务 - 创建顶点

时间:2015-12-24 21:14:35

标签: ibm-cloud graph-databases

我正在尝试使用顶点API创建顶点。

请查看以下代码段。

int remainder;
int quotient = Math.DivRem(7, 2, out remainder); 
int whatYouWant = quotient;

API网址上的卷曲工作正常,我收到了以下回复

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()

我想这个回答是正确的。

但API网址给我以下错误。

  

引发HTTPError(http_error_msg,response = self)   requests.exceptions.HTTPError:502服务器错误:网关错误

1 个答案:

答案 0 :(得分:2)

正如Bill上面提到的,此问题已在最新版本的服务中得到修复。请再试一次并更新此问题。

要获取最新更新,您需要创建新服务https://console.ng.bluemix.net/catalog/services/graph-data-store/并运行您的程序。