munx
munx

Reputation: 11

Bluemix IBM Graph service - Create vertices

I am trying to create a vertex using the vertices 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

{
    "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.

raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 502 Server Error: Bad Gateway

Upvotes: 1

Views: 190

Answers (1)

Alaa Mahmoud
Alaa Mahmoud

Reputation: 743

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.

Upvotes: 2

Related Questions