RESTful API Guide

WD Fusion offers increased control and flexibility through a RESTful (REpresentational State Transfer) API. You can view the details of the available endpoints in the Automatically generated API Guide that is bundled with the installation.

Below are listed some example calls that you can use to guide the construction of your own scripts and API driven interactions.

1. Overview

Note the following:

  • All calls use the base URI:
    http(s)://<server-host>:8082/fusion/<resource>
    				
  • The internet media type of the data supported by the web service is application/xml.
  • The API is hypertext driven, using the following HTTP methods:
Type Action
POST Create a resource on the server
GET Retrieve a resource from the server
PUT Modify the state of a resource
DELETE Remove a resource


2. Examples

The following examples illustrate some simple use cases, most are direct calls through a web browser, although for deeper or interactive examples, a curl client may be used.

Mount point information

http://<WDFUSION.URL.COM>:8082/fusion/

Calling the mount point outputs infor

Output
<application>
		<applicationLocation>.</applicationLocation>
		<beaconPeriod>1000</beaconPeriod>
		<DConePort>6789</DConePort>
		<databaseLocation>/opt/fusion-server/dcone/db</databaseLocation>
		<httpPort>8082</httpPort>
		<httpsPort>0</httpsPort>
		<sslEnabled>false</sslEnabled>
</application>

Read more about the mount point /fusion/fs.

API documentation is still in development:
Note that the API documentation is incomplete and requires clarification of available endpoints.


List all replicated paths

http://<WDFUSION.URL.COM>:8082/fusion/fs
Output
<fsMap>
		<replicatedDirectory>
		<uri>/repl1</uri>
		<membershipId>simpleMembership</membershipId>
		<familyRepresentativeId>
		<nodeId>wdfs1</nodeId>
		<dsmId>9bc8170e-e70d-11e4-95f9-ae4369cdbb06</dsmId>
		</familyRepresentativeId>
		<consistency>
		<state>UNKNOWN</state>
		<lastCheck>0</lastCheck>
		<nextCheck>1429587297002</nextCheck>
		</consistency>
		<isLeader>true</isLeader>
		<isWriter>true</isWriter>
		<gsn>407</gsn>
		</replicatedDirectory>
</fsMap>

Return a specific replicated path

Output q
<replicatedDirectory>
<uri>/repl1</uri>
		<membershipId>simpleMembership</membershipId>
		<familyRepresentativeId>
		<nodeId>wdfs1</nodeId>
		<dsmId>9bc8170e-e70d-11e4-95f9-ae4369cdbb06</dsmId>
		</familyRepresentativeId>
		<consistency>
		<state>UNKNOWN</state>
		<lastCheck>0</lastCheck>
		<nextCheck>1429587297002</nextCheck>
		</consistency>
		<isLeader>true</isLeader>
		<isWriter>true</isWriter>
		<gsn>411</gsn>
</replicatedDirectory>

Show inbound transfers

http://<WDFUSION.URL.COM>:8082/fusion/fs/transfers

Show tasks

http://wdfusion8.ec2.wandisco.com:8082/fusion/tasks
Output
<tasks>
<task xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="membershipProposalTaskDTO">
		<taskId>8391e4c7-e803-11e4-b2f1-c62bbea4984d</taskId>
		<timeCreated>1429606251844</timeCreated>
		<creatorNodeId>wdfs1</creatorNodeId>
		<timeUpdated>1429606252381</timeUpdated>
		<isDone>true</isDone>
		<aborted>false</aborted>
		<properties>
				<entry>
				<key>TASK_TYPE</key>
				<value>MEMBERSHIP_PROPOSAL_TASK_TYPE</value>
				</entry>
		</properties>
		<previousTask xsi:nil="true"/>
		<message>
		DeployFsStateMachineProposal. taskId: 8391e4c7-e803-11e4-b2f1-c62bbea4984d, creatorNodeId: wdfs1, membershipId: simpleMembership, dsmId: 8391e4c8-e803-11e4-b2f1-c62bbea4984d, uri: /repl1
		</message>
</task>
<task xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="beaconTaskDTO">
		<taskId>6ea76f8d-e803-11e4-b2f1-c62bbea4984d</taskId>
		<timeCreated>1429606216697</timeCreated>
		<creatorNodeId>wdfs1</creatorNodeId>
		<timeUpdated>1429606216804</timeUpdated>
		<isDone>true</isDone>
		<aborted>false</aborted>
		<properties>
				<entry>
				<key>TASK_TYPE</key>
				<value>CREATE_MEMBERSHIP_TASK_TYPE</value>
				</entry>
		</properties>
		<previousTask xsi:nil="true"/>
		<message>
		CreateDistributedMembershipRequest New memberships:[Identity: simpleMembership Distinguished node: wdfs1@location1 Role: acceptor Node: wdfs1@location1 Node: wdfs2@location2 Role: learner Node: wdfs1@location1 Node: wdfs2@location2 Role: proposer Node: wdfs1@location1 Node: wdfs2@location2] TaskId 6ea76f8d-e803-11e4-b2f1-c62bbea4984d sent by Node wdfs1@location1
		</message>
		</task>
		<task xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ecosystemCommittedTaskDTO">
		<taskId>59ae52ca-e803-11e4-88e6-c228c4f805ee</taskId>
		<timeCreated>1429606182362</timeCreated>
		<creatorNodeId>wdfs1</creatorNodeId>
		<timeUpdated>1429606184504</timeUpdated>
		<isDone>true</isDone>
		<aborted>false</aborted>
		<properties>
				<entry>
				<key>induction.final.task.id</key>
				<value>59ae52c9-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
				<entry>
				<key>TASK_TYPE</key>
				<value>induction.commit.task</value>
				</entry>
				<entry>
				<key>induction.identity</key>
				<value>59ae52c1-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
		</properties>
		<previousTask>5a305481-e803-11e4-b2f1-c62bbea4984d</previousTask>
</task>
<task xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="membershipProposalTaskDTO">
		<taskId>5a7d3c05-e803-11e4-b2f1-c62bbea4984d</taskId>
		<timeCreated>1429606182867</timeCreated>
		<creatorNodeId>wdfs1</creatorNodeId>
		<timeUpdated>1429606183518</timeUpdated>
		<isDone>true</isDone>
		<aborted>false</aborted>
		<properties>
				<entry>
				<key>induction.commit.task.id</key>
				<value>59ae52ca-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
				<entry>
				<key>inductor.start.task.id</key>
				<value>59ae52c7-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
				<entry>
				<key>TASK_TYPE</key>
				<value>induction.new.learner.task</value>
				</entry>
		</properties>
		<previousTask>5a305481-e803-11e4-b2f1-c62bbea4984d</previousTask>
		<message>
		AddNewNodesToEcosystem. taskId: 5a7d3c05-e803-11e4-b2f1-c62bbea4984d, creatorNodeId: wdfs1, newMembershipId: ECO-MEMBERSHIP-59addd8f-e803-11e4-88e6-c228c4f805ee, dsmId: ECO-DSM-24f8d34b-e803-11e4-b2f1-c62bbea4984d, newLearnerNodeIds: [wdfs2]
		</message>
</task>
<task xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="beaconTaskDTO">
		<taskId>5a305481-e803-11e4-b2f1-c62bbea4984d</taskId>
		<timeCreated>1429606182362</timeCreated>
		<creatorNodeId>wdfs1</creatorNodeId>
		<timeUpdated>1429606182888</timeUpdated>
		<isDone>true</isDone>
		<aborted>false</aborted>
		<properties>
				<entry>
				<key>induction.commit.task.id</key>
				<value>59ae52ca-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
				<entry>
				<key>inductor.start.task.id</key>
				<value>59ae52c7-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
				<entry>
				<key>TASK_TYPE</key>
				<value>induction.create.new.membership</value>
				</entry>
		</properties>
		<previousTask>59ae52c7-e803-11e4-88e6-c228c4f805ee</previousTask>
		<nextTasks>59ae52ca-e803-11e4-88e6-c228c4f805ee</nextTasks>
		<nextTasks>5a7d3c05-e803-11e4-b2f1-c62bbea4984d</nextTasks>
		<message>
		CreateEcosystemMembership. taskId: 5a305481-e803-11e4-b2f1-c62bbea4984d, inductionIdentity: 59ae52c1-e803-11e4-88e6-c228c4f805ee, inductorIdentity: wdfs1, membership: Identity: ECO-MEMBERSHIP-59addd8f-e803-11e4-88e6-c228c4f805ee Distinguished node: wdfs1@location1 Role: acceptor Node: wdfs1@location1 Node: wdfs2@location2 Role: learner Node: wdfs1@location1 Node: wdfs2@location2 Role: proposer Node: wdfs1@location1 Node: wdfs2@location2, nodesInfo: [NodeInfo. nodeIdentity: wdfs1, nodeName: wdfs1, location: [Location: Identity:location1], ecosystemDsmId: ECO-DSM-24f8d34b-e803-11e4-b2f1-c62bbea4984d, ecosystemMembershipId: ECO-MEMBERSHIP-wdfs1, eventRoutes: [EventRoute:fusion-daily-01-vm1.qauk.wandisco.com:6789], NodeInfo. nodeIdentity: wdfs2, nodeName: wdfs2, location: [Location: Identity:location2], ecosystemDsmId: ECO-DSM-48b2c9fd-e803-11e4-88e6-c228c4f805ee, ecosystemMembershipId: ECO-MEMBERSHIP-wdfs2, eventRoutes: [EventRoute:fusion-daily-02-vm1.qauk.wandisco.com:6789]], inductionConfiguration: InductionConfiguration{inductorConfig={}, inducteeConfig={}, mergedConfig={}, new seed=59b9019c-e803-11e4-b2f1-c62bbea4984d}, commitTaskId: 59ae52ca-e803-11e4-88e6-c228c4f805ee
		</message>
</task>
<task xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="dsmProposalTaskDTO">
		<taskId>59ae52c7-e803-11e4-88e6-c228c4f805ee</taskId>
		<timeCreated>1429606182053</timeCreated>
		<creatorNodeId>wdfs1</creatorNodeId>
		<timeUpdated>1429606182433</timeUpdated>
		<isDone>true</isDone>
		<aborted>false</aborted>
		<properties>
				<entry>
				<key>induction.inductee.nodes.info</key>
				<value>
				[NodeInfo. nodeIdentity: wdfs2, nodeName: wdfs2, location: [Location: Identity:location2], ecosystemDsmId: ECO-DSM-48b2c9fd-e803-11e4-88e6-c228c4f805ee, ecosystemMembershipId: ECO-MEMBERSHIP-wdfs2, eventRoutes: [EventRoute:fusion-daily-02-vm1.qauk.wandisco.com:6789]]
				</value>
				</entry>
				<entry>
				<key>induction.final.task.id</key>
				<value>59ae52c9-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
				<entry>
				<key>induction.commit.task.id</key>
				<value>59ae52ca-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
				<entry>
				<key>inductor.membership.id</key>
				<value>ECO-MEMBERSHIP-wdfs1</value>
				</entry>
				<entry>
				<key>inductor.identity</key>
				<value>wdfs1</value>
				</entry>
				<entry>
				<key>induction.eco.system.membership.id</key>
				<value>
				ECO-MEMBERSHIP-59addd8f-e803-11e4-88e6-c228c4f805ee
				</value>
				</entry>
				<entry>
				<key>inductee.membership.id</key>
				<value>ECO-MEMBERSHIP-wdfs2</value>
				</entry>
				<entry>
				<key>inductee.identity</key>
				<value>wdfs2</value>
				</entry>
				<entry>
				<key>remote.inductor.baton.beacon.task.id</key>
				<value>59ae52c5-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
				<entry>
				<key>TASK_TYPE</key>
				<value>INDUCTION_TASK</value>
				</entry>
				<entry>
				<key>inductor.prepare.asm.id</key>
				<value>59ae52c6-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
				<entry>
				<key>inductee.location.id</key>
				<value>location2</value>
				</entry>
				<entry>
				<key>induction.start.task.id</key>
				<value>59ad1a3e-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
				<entry>
				<key>induction.identity</key>
				<value>59ae52c1-e803-11e4-88e6-c228c4f805ee</value>
				</entry>
		</properties>
		<previousTask xsi:nil="true"/>
		<nextTasks>5a305481-e803-11e4-b2f1-c62bbea4984d</nextTasks>
		<message>
		PrepareInductorBaton[InductionBaton{taskId=59ae52c7-e803-11e4-88e6-c228c4f805ee, inductionIdentity=59ae52c1-e803-11e4-88e6-c228c4f805ee, dsmId=ECO-DSM-24f8d34b-e803-11e4-b2f1-c62bbea4984d, nodesInfo=[NodeInfo. nodeIdentity: wdfs2, nodeName: wdfs2, location: [Location: Identity:location2], ecosystemDsmId: ECO-DSM-48b2c9fd-e803-11e4-88e6-c228c4f805ee, ecosystemMembershipId: ECO-MEMBERSHIP-wdfs2, eventRoutes: [EventRoute:fusion-daily-02-vm1.qauk.wandisco.com:6789]], asmIdentity=59ae52c6-e803-11e4-88e6-c228c4f805ee}]
		</message>
		<dsmId>ECO-DSM-24f8d34b-e803-11e4-b2f1-c62bbea4984d</dsmId>
</task>
</tasks>		

Show memberships

http://<WDFUSION.URL.COM>:8082/fusion/memberships

Show Nodes

http://<WDFUSION.URL.COM>:8082/fusion/nodes
Output
<nodes>
	<node>
		<nodeIdentity>wdfs1</nodeIdentity>
		<locationIdentity>location1</locationIdentity>
		<isLocal>true</isLocal>
		<isUp>true</isUp>
		<isStopped>false</isStopped>
		<lastStatusChange>1429606531682</lastStatusChange>
		<attributes>
		<attribute>
		<key>eco.system.dsm.identity</key>
		<value>ECO-DSM-24f8d34b-e803-11e4-b2f1-c62bbea4984d</value>
		</attribute>
		<attribute>
		<key>node.name</key>
		<value>wdfs1</value>
		</attribute>
		<attribute>
		<key>eco.system.membership</key>
		<value>
		ECO-MEMBERSHIP-59addd8f-e803-11e4-88e6-c228c4f805ee
		</value>
		</attribute>
		</attributes>
	</node>
	<node>
		<nodeIdentity>wdfs2</nodeIdentity>
		<locationIdentity>location2</locationIdentity>
		<isLocal>false</isLocal>
		<isUp>true</isUp>
		<isStopped>false</isStopped>
		<lastStatusChange>1429606531699</lastStatusChange>
		<attributes>
		<attribute>
		<key>eco.system.dsm.identity</key>
		<value>ECO-DSM-24f8d34b-e803-11e4-b2f1-c62bbea4984d</value>
		</attribute>
		<attribute>
		<key>node.name</key>
		<value>wdfs2</value>
		</attribute>
		<attribute>
		<key>eco.system.membership</key>
		<value>
		ECO-MEMBERSHIP-59addd8f-e803-11e4-88e6-c228c4f805ee
		</value>
		</attribute>
		</attributes>
	</node>
</nodes>

Show replicated directories

http://<WDFUSION.URL.COM>:8082/fusion/fs

Show a specific replicated directory

http://<WDFUSION.URL.COM>:8082/dcone/fs?path=/repl1

Add another replicated directory

create a file called stateMachine.xml for use as payload in the REST API call. Note: membershipId should point to an existing membership:

stateMachine.xml

<replicatedDirectory>
     <uri>/repl1</uri>
     <membershipId>simpleMembership</membershipId>
     <familyRepresentativeId>
          <nodeId>ohs1</nodeId>
     </familyRepresentativeId>
</replicatedDirectory>

Curl Call to Add It:

curl -v -X POST -d@./stateMachine.xml -H "Content-Type: application/xml" http://<WDFUSION.URL.COM>:8082/fusion/fs

Remove a directory from replication

curl -X DELETE http://<WDFUSION.URL.COM>:8082/fusion/fs?path=/repl1

Remove a node from WD Fusion

The following procedure uses the REST API to remove a node from your WD Fusion enabled cluster.

  1. Create an XML file called removal.xml for use as a payload to be delivered to the replicated system using a curl command. The file should contain the following snippet:
    <nodes>
      <node>
      <nodeIdentity>${NODE_ID}</nodeIdentity>
      <locationIdentity>${LOCATION_ID}</locationIdentity>
      </node>
    </nodes>
    NODE_ID
    The node ID of the node that you are going to remove from the replicated ecosystem. E.g. "host292-fus_44".
    LOCATION_ID
    The location ID of the node that you want to remove from the ecosystem.
    You can view these properties by pointing your browser at the node that you want to remove, using the following port and path:
    http://<WDFUSION.URL.COM>:8082/fusion/nodes
    The curl should be constructed as follows:
    curl -u <username>: <password> -X PUT -d @"$removal.xml" --header 'Content-Type: application/xml' http://<WDFUSION.URL.COM>:8082/fusion/node/${LOCAL_NODE_ID}/removenodes
     

Consistency Check

You can trigger consistency checks through:

curl -v -X POST http://<WDFUSION.URL.COM>:8082/fusion/fs/check?path=/folder_name

Take the taskId returned in the content-location header and view the report with (e.g.)

http://wdfusion2.com:8082/fusion/fs/check/b911241f-c430-11e4-9486-0ebe9eaaf785

The task can also be viewed as usual:

http://<WDFUSION.URL.COM>:8082/dcone/task/b911241f-c430-11e4-9486-0ebe9eaaf785

Getting location information

http://wdfusion2.com:8082/fusion/locations
Output
<locations>
	<location>
		<locationIdentity>location2</locationIdentity>
		<isLocal>false</isLocal>
		<routes/>
		<attributes>
		<attribute>
		<key>location.property.longitude</key>
		<value>-1.4667</value>
		</attribute>
		<attribute>
		<key>location.property.latitude</key>
		<value>53.3833</value>
		</attribute>
		<attribute>
		<key>data.center</key>
		<value>dc2</value>
		</attribute>
		</attributes>
	</location>
	<location>
		<locationIdentity>location1</locationIdentity>
		<isLocal>true</isLocal>
		<routes/>
		<attributes>
		<attribute>
		<key>location.property.longitude</key>
		<value>-1.4667</value>
		</attribute>
		<attribute>
		<key>location.property.latitude</key>
		<value>53.3833</value>
		</attribute>
		<attribute>
		<key>data.center</key>
		<value>dc1</value>
		</attribute>
		</attributes>
	</location>
</locations>

Getting location information for a specific location

http://wdfusion2.com:8082/fusion/location/location1

Setting a nodes latitude and longitude create an xml file for the node e.g. virginia.xml

<attributes>
   <attribute>
      <key>location.property.longitude</key>
      <value>-76.453206</value>
   </attribute>
   <attribute>
      <key>location.property.latitude</key>
      <value>37.479401</value>
   </attribute>
</attributes>
curl -v -X PUT -d@./virginia.xml -H "Content-Type: application/xml"http://<WDFUSION.URL.COM>:8082/fusion/location/[LocationID]/attributes"

where location1 is the actual location name

Stop and Start fusion server to see reflected in UI

Writers and Leaders

The writer is the 'elected leader' for the state machine replicas in a zone and the leader is the 'elected leader' for the entire set of state machine replicas.

There are as many writers as there are zones but only one leader.

Like a local leader vs global leader.



Repair Status

Gets a list of repairs done or being on done on this zone. Its important to note that this information exists in the node that is or was doing the repair, not the "source-of-truth" or proposing zone.

<host>:8082/fusion/fs/repairs
showAll Whether or not to include past repairs for the same file. The options are true to show all repairs on the given path, and false to show only the last repair. false
path The path for which the list of repairs should be returned. If null, we will get all repairs. null
The path for which the list of repairs should be returned. If null, we will get all repairs. null
showAll Whether or not to include past repairs for the same file. The options are true to show all repairs on the given path, and false to show only the last repair. false
sortField The field by which the repairs should be sorted. The options are to sort by the "startTime", "completeTime" or "path". "startTime"
sortOrder The order in which the entries should be sorted according to the sort field. The options are to sort in ascending ("ASC") or descending ("DESC") order. "DESC"


Copyright © 2005-2017 WANdisco, Inc.
All rights reserved
This product is protected by copyright and distributed under licenses restricting copying, distribution and decompilation.

WANdisco WD Fusion UI version 2.9.4 Build 324
Last doc issue: 21 March 2017