简体   繁体   中英

In IBM Graph, How can delete my entire graph and start over without deleting my instance

I'm using IBM Graph and I'd like to be able to delete my entire graph to reload the data. I'm told that I need to delete my service instance and create a new one. Is there any other way to do this without having to keep creating new instances?

Yes absolutely!

The best way to do this is to use the /_graphs endpoint which allows you to manage multiple graphs under the same instance.

Here's how you'd delete grph g2

Delete a graph : DELETE /_graphs/:_gid

$curl  -u  username:password  -X DELETE "http://.../<serviceid>/g2"

But you can also do other neat stuff as well such as

Adding a new graph POST /_graphs

$curl  -u  username:password  -X POST "http://.../<serviceid>/_graphs"

$ {"graph_id":"105512b6-db95-412c-aa3c-6b8fa6c3a844","dbUrl":"http://.../<serviceid>/105512b6-db95-412c-aa3c-6b8fa6c3a844"}

Add a graph with a specific name POST /_graphs/:_gid

$curl  -u  username:password  -X POST "http://.../<serviceid>/_graphs/g2"

$ {"graph_id":"g2","dbUrl":"http://127.0.0.1:3001/service123/g2"}

Get List of Graphs GET /_graphs

$curl  -u  username:password  -X GET "http://.../<serviceid>/_graphs"

$ {"graph_ids":["g2","105512b6-db95-412c-aa3c-6b8fa6c3a844","203312b6-de95-412c-ab3c-6b8fe6cda844"]}

the "delete" method doesn't support in bluemix, it will return below error when trying to delete a graph:

{"code":"MethodNotAllowedError","message":"DELETE is not allowed"}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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