Skip to content

RESTful API

Akram El Assas edited this page Jul 1, 2023 · 9 revisions

Wexflow Server is a standalone language-agnostic solution that can be integrated to an app that runs PHP, NodeJS, Ruby, Python, etc. via a RESTful API.

Basic access authentication is used for all API methods. Thus, Authorization header must be set in every API call.

Passwords must be encrypted in MD5 checksums.

Here is a sample Authorization header for the user admin:

Authorization Basic YWRtaW46ZWUwNWVhYWJhN2I3NmYxNmUyODVkOTgzZDYwNWM5YmY=

which corresponds to username:md5(password) base64 encoded:

Basic base64(admin:ee05eaaba7b76f16e285d983d605c9bf)
Basic base64(admin:md5(wexflow2018))

The default password of the user admin is wexflow2018. You can change it from the back end.

You can access Swagger UI from: http://localhost:8000

Dashboard

GET http://localhost:8000/api/v1/status-count
Returns status count.

GET http://localhost:8000/api/v1/entries-count-by-date?s={keyword}&from={date}&to={date}
Returns entries count by keyword and date filter.

GET http://localhost:8000/api/v1/search-entries-by-page-order-by?s={keyword}&from={date}&to={date}&page={page}&entriesCount={entriesCount}&heo={orderBy}
Searches for entries.

GET http://localhost:8000/api/v1/entry-status-date-min
Returns entry min date.

GET http://localhost:8000/api/v1/entry-status-date-max
Returns entry max date.

Manager

GET http://localhost:8000/api/v1/search?s={keyword}
Search for workflows.

GET http://localhost:8000/api/v1/search-approval-workflows?s={keyword}
Search for approval workflows.

GET http://localhost:8000/api/v1/workflow?w={id}
Returns a workflow from its id.

POST http://localhost:8000/api/v1/start?w={id}
Starts a workflow.

POST http://localhost:8000/api/v1/start-with-variables
Starts a workflow with variables.

Here is a sample payload:

{
	"WorkflowId":131,
	"Variables":[
	  {
		 "Name":"restVar1",
		 "Value":"C:\\WexflowTesting\\file1.txt"
	  },
	  {
		 "Name":"restVar2",
		 "Value":"C:\\WexflowTesting\\file2.txt"
	  }
	]
}

Here is a sample workflow:

<Workflow xmlns="urn:wexflow-schema" id="138" name="Workflow_RestVariables" description="Workflow_RestVariables">
  <Settings>
    <Setting name="launchType" value="trigger" />
    <Setting name="enabled" value="true" />
  </Settings>
  <LocalVariables></LocalVariables>
  <Tasks>
    <Task id="1" name="FilesLoader" description="Loading files" enabled="true">
      <Setting name="file" value="$restVar1" />
      <Setting name="file" value="$restVar2" />
    </Task>
    <Task id="2" name="ListFiles" description="Listing files" enabled="true"></Task>
  </Tasks>
</Workflow>

POST http://localhost:8000/api/v1/stop?w={id}
Stops a workflow.

POST http://localhost:8000/api/v1/suspend?w={id}
Suspends a workflow.

POST http://localhost:8000/api/v1/resume?w={id}
Resumes a workflow.

POST http://localhost:8000/api/v1/approve?w={id}
Approves a workflow.

POST http://localhost:8000/api/v1/disapprove?w={id}
Disapproves a workflow.

Designer

GET http://localhost:8000/api/v1/tasks/{id}
Returns workflow's tasks.

GET http://localhost:8000/api/v1/xml/{id}
Returns a workflow as XML.

GET http://localhost:8000/api/v1/json/{id}
Returns a workflow as JSON.

GET http://localhost:8000/api/v1/task-names
Returns task names.

GET http://localhost:8000/api/v1/settings/{taskName}
Returns task settings.

POST http://localhost:8000/api/v1/task-to-xml
Returns a task as XML.

GET http://localhost:8000/api/v1/is-workflow-id-valid/{id}
Checks if a workflow id is valid.

GET http://localhost:8000/api/v1/is-cron-expression-valid?e={cronExpression}
Checks if a cron expression is valid.

GET http://localhost:8000/api/v1/is-period-valid/{period}
Checks if a period is valid.

POST http://localhost:8000/api/v1/is-xml-workflow-valid
Checks if the XML of a workflow is valid.

POST http://localhost:8000/api/v1/save-xml
Saves a workflow from XML.

POST http://localhost:8000/api/v1/save
Saves a workflow from JSON.

POST http://localhost:8000/api/v1/delete?w={id}
Deletes a workflow.

POST http://localhost:8000/api/v1/delete-workflows
Deletes workflows.

GET http://localhost:8000/api/v1/graph/{id}
Returns the execution graph of the workflow.

History

GET http://localhost:8000/api/v1/history-entries-count-by-date?s={keyword}&from={date}&to={date}
Returns history entries count by keyword and date filter.

GET http://localhost:8000/api/v1/search-history-entries-by-page-order-by?s={keyword}&from={date}&to={date}&page={page}&entriesCount={entriesCount}&heo={orderBy}
Searches for history entries.

GET http://localhost:8000/api/v1/history-entry-status-date-min
Returns history entry min date.

GET http://localhost:8000/api/v1/history-entry-status-date-max
Returns history entry max date.

Users

GET http://localhost:8000/api/v1/user?username={username}
Returns a user from his username.

GET http://localhost:8000/api/v1/search-users?keyword={keyword}&uo={orderBy}
Searches for users.

POST http://localhost:8000/api/v1/insert-user?username={username}&password={password}&up={userProfile}&email={email}
Inserts a user.

POST http://localhost:8000/api/v1/update-user?userId={userId}&username={username}&password={password}&up={userProfile}&email={email}
Updates a user.

POST http://localhost:8000/api/v1/update-username-email-user-profile?userId={userId}&username={username}&password={password}&up={userProfile}&email={email}
Updates the username, the email and the user profile of a user.

POST http://localhost:8000/api/v1/delete-user?username={username}&password={password}
Deletes a user.

POST http://localhost:8000/api/v1/reset-password?username={username}
Resets a password.

Profiles

GET http://localhost:8000/api/v1/search-admins?keyword={keyword}&uo={orderBy}
Searches for administrators.

GET http://localhost:8000/api/v1/user-workflows?u={userId}
Returns user workflows.

POST http://localhost:8000/api/v1/save-user-workflows
Saves user workflow relations.

Clone this wiki locally