Skip to content

Instantly share code, notes, and snippets.

@balcsida
Created July 2, 2019 18:56
Show Gist options
  • Save balcsida/5eaf7e2377b2bf8329789bbac7c6e411 to your computer and use it in GitHub Desktop.
Save balcsida/5eaf7e2377b2bf8329789bbac7c6e411 to your computer and use it in GitHub Desktop.

WeDeploy API

Control your WeDeploy cloud services via a simple RESTful api

Overview

This describes the resources that make up the official WeDeploy API v1. If you have any problems or requests please contact support. All API access is over HTTPS, and accessed from the https://api.wedeploy.com.

Table of Contents

Status

Get status

GET /
Parameters
Name Type Required Options
status string auth, data, email, storage, all
Request
curl "https://api.wedeploy.com/"
Response 200 OK
{
  version: "0.0.0",
  domains: {
    infrastructure: "wedeploy.com",
    service: "wedeploy.io"
  }
}
Request
curl "https://api.wedeploy.com/?status=all"
curl "https://api.wedeploy.com/?status=auth"
curl "https://api.wedeploy.com/?status=data"
curl "https://api.wedeploy.com/?status=email"
curl "https://api.wedeploy.com/?status=storage"
Response 200 OK
{
  status: "up"
}

Projects

Create a project

POST /projects
Parameters
Name Type Required
github Object
projectId string
environment boolean
metadata Object
Request
curl -X POST "https://api.wedeploy.com/projects" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "projectId": "myproject"
}'
Response 200 OK
{
  "collaborators": [
    "212069869435631201"
  ],
  "createdAt": 1490046559186,
  "github": {},
  "health": "healthy",
  "id": "<UID>",
  "invitations": {},
  "masterToken": "<MASTER_TOKEN>",
  "ownerId": "212069869435631201",
  "projectId": "myproject"
}

List projects

GET /projects
Parameters
Name Type Required Options
filter string allProjects, ownedProjects, contributedProjects
field string projectId, createdAt, latestActivity
order string asc, desc
listServices boolean
Request
curl "https://api.wedeploy.com/projects?filter=allProjects&field=projectId&order=desc&listServices=true" -u user@domain.com:pass
Response 200 OK
[
  {
    "collaborators": [
      "212069869435631201"
    ],
    "createdAt": 1490046559186,
    "github": {},
    "health": "healthy",
    "id": "<UID>",
    "invitations": {},
    "masterToken": "<MASTER_TOKEN>",
    "ownerId": "212069869435631201",
    "projectId": "myproject",
    "services": [...]
  }
]

Get a project

GET /projects/:projectId
Parameters
Name Type Required Options
listServices boolean
Request
curl "https://api.wedeploy.com/projects/myproject?listServices=true" -u user@domain.com:pass
Response 200 OK
{
  "collaborators": [
    "212069869435631201"
  ],
  "createdAt": 1490046559186,
  "github": {},
  "health": "healthy",
  "id": "<UID>",
  "invitations": {},
  "masterToken": "<MASTER_TOKEN>",
  "ownerId": "212069869435631201",
  "projectId": "myproject",
  "services": [...]
}

Update a project

PATCH /projects/:projectId/:masterToken?
Parameters
Name Type Required
github Object
metadata Object
Request
curl -X PATCH "https://api.wedeploy.com/projects/myproject/<PROJECT_MASTER_TOKEN>" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "github": {}
  "metadata": {
    "dynatraceId": 1234,
  }
}'
Response 200 OK
{
  "collaborators": [
    "212069869435631201"
  ],
  "createdAt": 1490046559186,
  "github": {},
  "health": "healthy",
  "id": "<UID>",
  "invitations": {},
  "masterToken": "<MASTER_TOKEN>",
  "ownerId": "212069869435631201",
  "projectId": "myproject"
}

Delete a project

DELETE /projects/:projectId
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject" -u user@domain.com:pass
Response 204 No Content
(empty)

Build project services

POST /projects/:projectId/build
Parameters
Name Type Required
deploy boolean
provider string
repository string
masterToken string
wedeployGitBranch string
wedeployJsons Object
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/build" \
     -H "Content-Type: application/json" \
     -d $'{
  "masterToken": "<PROJECT_MASTER_TOKEN>",
  "provider": "github",
  "repository": "https://github.com/wedeploy/demo-ghost",
  "wedeployJsons": {
    "ui": {
      "cpu": "0.75"
    }
  }
}'
Response 200 OK
[
  {
    "cpu": 1.0,
    "createdAt": 1490054338701,
    "buildGroupUid": "<BUILD_GROUP_ID>",
    "deployGroupUid": "<DEPLOY_GROUP_ID>",
    "groupUid": "<DEPLOY_GROUP_ID>",
    "health": "up",
    "id": "<UID>",
    "image": "wedeploy/hosting",
    "memory": 4096,
    "port": 80,
    "projectId": "myproject",
    "scale": 1,
    "serviceId": "hosting"
  },
  ...
]

Deploy or Promote project services

POST /projects/:projectId/deploy
Parameters
Name Type Required
(deprecating) groupUid string
buildGroupUid string X
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/deploy" \
     -H "Content-Type: application/json" \
     -d $'{
  "buildGroupUid": "1",
}'
Response 200 OK
(empty)

Transfer project

POST /projects/:projectId/transfer
Parameters
Name Type Required
userId string
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/transfer" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "userId": "1"
}'
Response 200 OK
(empty)

Copy project services to child project

POST /projects/:projectId/copy
Parameters
Name Type Required
destinationProjectId string
wedeployJsons Object
Request
curl -X POST "https://api.wedeploy.com/projects/example/copy" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "destinationProjectId": "example-dev",
  "wedeployJsons": {
    "ui": {
      "cpu": "0.75",
    }
  }
}'
Response 200 OK
[
  {
    "image": "wedeploy/hosting",
    "memory": 1365.3333,
    "projectUid": "284690249352078105",
    "internalPort": 45594,
    "volumes": {},
    "cpu": 0.75,
    "health": "none",
    "scale": 1,
    "zeroDowntime": true,
    "constraints": [],
    "dependencies": [],
    "createdAt": 1524252889735,
    "customDomains": [],
    "port": 80,
    "healthCheck": { startPeriod: 1, retries: 10, interval: 5, timeout: 5 },
    "id": "284690250138355225",
    "serviceId": "ui",
    "projectId": "example-dev",
    "groupUid": "rwq3ih2"
  },
  ...
]

List project logs

GET /projects/:projectId/logs

Parameters

Name Type Required
serviceId string
start integer
end integer
limit integer
level integer
build boolean
download boolean
Request
curl "https://api.wedeploy.com/projects/myproject/logs" -u user@domain.com:pass
Response 200 OK
[
  {
    "buildUid": null,
    "containerId": "serviceId",
    "containerUid": "<CONTAINER_UID>",
    "deployUid": "<DEPLOY_UID>",
    "level": 6,
    "message": "A line of the log...",
    "projectId": "myproject",
    "timestamp": "1487022020949",
    "uid": "<UID>"
  },
  ...
]

Invite project collaborator

POST /projects/:projectId/invite
Parameters
Name Type Required
email string ✓ (exclusive)
userId string ✓ (exclusive)
role string
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/invite" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "email@domain.com"
  "role": "guest",
}'
Response 200 OK
(empty)

Accept project collaborator invitation

GET /projects/:projectId/invite
Parameters
Name Type Required
email string
invitationToken string
Request
curl "https://api.wedeploy.com/projects/myproject/invite?email=email@domain.com&invitationToken=INVITATION_TOKEN" -u user@domain.com:pass
Response 200 OK
(empty)

Delete project collaborator invitation

DELETE /projects/:projectId/invite
Parameters
Name Type Required
email string
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/invite?email=email@domain.com" -u user@domain.com:pass
Response 204 No Content
(empty)

Suggest project collaborator

GET /projects/:projectId/invite/suggestion
Parameters
Name Type Required
keyword string
limit integer
Request
curl "https://api.wedeploy.com/projects/myproject/invite/suggestion?keyword=user" -u user@domain.com:pass
Response 200 OK
[
  {
    "id": "<UID>",
    "initials": "U",
    "name": "User A",
    "email": "usera@domain.com",
    "emailHash": "3bc81bc52e7f209c3455af320abeee00"
  },
  {
    "id": "<UID>",
    "initials": "U",
    "name": "User B",
    "email": "userb@domain.com",
    "emailHash": "ed076488b22b5359d7ffb16b8e30caed"
  }
]

Delete project collaborator

DELETE /projects/:projectId/collaborators/:id
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/collaborators/1" -u user@domain.com:pass
Response 204 No Content
(empty)

Get project collaborators

GET /projects/:projectId/collaborators
Request
curl "https://api.wedeploy.com/projects/myproject/collaborators"
     -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": 1489019572853,
    "email": "user@domain.com",
    "id": "<UID>",
    "initials": "E",
    "invitationPending": false,
    "name": "User Name"
  },
  ...
]

Link project git provider

POST /projects/:projectId/link-provider
Parameters
Name Type Required
provider string
providerToken string
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/link-provider" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "provider": "github",
  "providerToken": "<GITHUB_TOKEN>"
}'
Response 200 OK
(empty)

Unlink project git provider

DELETE /projects/:projectId/link-provider
Parameters
Name Type Required
provider string
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/link-provider?provider=github" -u user@domain.com:pass
Response 204 No Content
(empty)

Link project git repository

POST /projects/:projectId/link-repository
Parameters
Name Type Required
branch string
provider string
repository string
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/link-repository" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "branch": "master",
  "provider": "github",
  "repository": "user/myproject"
}'
Response 200 OK
(empty)

Unlink project git repository

DELETE /projects/:projectId/link-repository
Parameters
Name Type Required
provider string
providerHookId string
providerToken string
repository string
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/link-repository?provider=github&providerToken=TOKEN&providerHookId=HOOK_ID" -u user@domain.com:pass
Response 204 No Content
(empty)

Change Collaborator Project Role

PATCH /projects/:projectId/collaborator-role
Parameters
Name Type Required
collaboratorId string
role string
Request
curl -X PATCH "https://api.wedeploy.com/projects/myProject/collaborator-role" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -u user@domain.com:pass \
  -d $'{
    "collaboratorId": "12345678",
    "role": "guest"
  }'
Response 204 No Content
(empty)

Services

Create project service

POST /projects/:projectId/services
Parameters
Name Type Required
command array
constraints array
cpu integer
customDomains array
env Object
image string
imageHint string
memory integer
port integer
public boolean
scale integer
serviceId string
volume string
recipeType string
skipGenerateCertificate boolean
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/services" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "cpu": 1.0,
  "customDomains": [
    "myproject.com",
    "www.myproject.com"
  ],
  "env": {
    "NODE_ENV": "production"
  },
  "image": "wedeploy/hosting",
  "memory": 4096,
  "port": 80,
  "public": true,
  "scale": 1,
  "serviceId": "hosting",
  "volume": "/shared"
}'
Response 200 OK
{
  "cpu": 1.0,
  "createdAt": 1490054338701,
  "customDomains": [
    "myproject.com",
    "www.myproject.com"
  ],
  "health": "up",
  "id": "<UID>",
  "image": "wedeploy/hosting",
  "memory": 4096,
  "port": 80,
  "public": true,
  "projectId": "myproject",
  "scale": 1,
  "serviceId": "hosting",
  "volume": "/shared"
}

List project services

GET /projects/:projectId/services
Request
curl "https://api.wedeploy.com/projects/myproject/services" -u user@domain.com:pass
Response 200 OK
[
  {
    "cpu": 1.0,
    "createdAt": 1490054338701,
    "customDomains": [
      "myproject.com",
      "www.myproject.com"
    ],
    "health": "up",
    "id": "<UID>",
    "image": "wedeploy/hosting",
    "memory": 4096,
    "port": 80,
    "projectId": "myproject",
    "scale": 1,
    "serviceId": "hosting"
  }
]

Get project service

GET /projects/:projectId/services/:serviceId
Request
curl "https://api.wedeploy.com/projects/myproject/services/hosting" -u user@domain.com:pass
Response 200 OK
{
  "cpu": 1.0,
  "createdAt": 1490054338701,
  "health": "up",
  "customDomains": [
    "myproject.com",
    "www.myproject.com"
  ],
  "id": "<UID>",
  "image": "wedeploy/hosting",
  "memory": 4096,
  "port": 80,
  "projectId": "myproject",
  "scale": 1,
  "serviceId": "hosting"
}

Delete project service

DELETE /projects/:projectId/services/:serviceId
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/services/hosting" -u user@domain.com:pass
Response 204 No Content
(empty)

Restart project service

POST /projects/:projectId/services/:serviceId/restart
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/services/hosting/restart" -u user@domain.com:pass
Response 200 OK
(empty)

Stop project service

PATCH /projects/:projectId/services/:serviceId/stop
Request
curl -X PATCH "https://api.wedeploy.com/projects/myproject/services/hosting/stop" -u user@domain.com:pass
Response 200 OK
(empty)

List project service logs

GET /projects/:projectId/services/:serviceId/logs

Parameters

Name Type Required
start integer
end integer
limit integer
level integer
build boolean
download boolean
Request
curl "https://api.wedeploy.com/projects/myproject/services/hosting/logs" -u user@domain.com:pass
Response 200 OK
[
  {
    "buildUid": null,
    "containerId": "hosting",
    "containerUid": "<CONTAINER_UID>",
    "deployUid": "<DEPLOY_UID>",
    "level": 6,
    "message": "A line of the log...",
    "projectId": "myproject",
    "timestamp": "1487022020949",
    "uid": "<UID>"
  },
  ...
]

List project service instances

GET /projects/:projectId/services/:serviceId/instances
Request
curl "https://api.wedeploy.com/projects/myproject/services/hosting/instances" -u user@domain.com:pass
Response 200 OK
[
  {
  "createdAt": "2019-02-11T13:35:31.8960205Z",
  "containerId": "87bbb217b0f73c304dbd60291c6ecca1de9a62acaf098a01a501fa076e0c79cd",
  "state": "running",
  "taskId": "su8zo1bdng6ggbdb2kg4sl4xy"
  }
  ...
]

Replace project service custom domains

PUT /projects/:projectId/services/:serviceId/custom-domains
Parameters
Name Type Required
value array
skipGenerateCertificate boolean
skipAddDnsRecords boolean
Request
curl -X PUT "https://api.wedeploy.com/projects/myproject/services/hosting/custom-domains" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "value": [
    "myproject.com",
    "www.myproject.com"
  ]
}'
Response 200 OK

Update project service scale properties

PATCH /projects/:projectId/services/:serviceId/scale
Parameters
Name Type Required Description
difference int scale will increase/decrease by difference
value int scale will be replaced by value
canAutoscale boolean turn on/off autoscaling capability
Request
curl -X PATCH "https://api.wedeploy.com/projects/myproject/services/myservice/scale" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -u user@domain.com:pass \
  -d '{
    "scale": 2,
    "canAutoscale": true
  }'
Response 204 No Content
(empty)

Create project service integration activities

POST /projects/:projectId/services/:serviceId/integrations
Parameters
Name Type Required
type string
masterToken string
metadata Object
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/services/myservice/integrations" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d '{
    "type": "CI_STARTED",
    "masterToken": <PROJECT_MASTER_TOKEN>,
    "metadata": {
      "jenkinsURL": "www.jenkins.com"
    }
  }'
Response 200 OK
{
  createdAt: 1531525927705,
  metadata: {
    projectId: 'myproject',
    serviceId: 'myservice',
    integrationType: 'CI_STARTED'
    jenkinsURL: 'www.jenkins.com'
  },
  projectUid: '299942973016451145',
  id: '299942976036258986',
  type: 'INTEGRATION',
  projectId: 'myproject',
  userId: '_GLOBAL_'
}

Activities

List project activities

Parameters
Name Type Required Options
commit string
(deprecating) groupUid string
buildGroupUid string
limit integer
offset integer
type string
order string 'asc' (default), 'desc'
GET /projects/:projectId/activities
Request
curl "https://api.wedeploy.com/projects/myproject/activities" -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": "1474608905803",
    "id": "<UID>",
    "metadata": {
      "emailAddress": "email@domain.com",
      "emailAddressHash": "ZW1haWxAZG9tYWluLmNvbQ==",
      "userPhotoUrl": null,
      "projectId": "myproject",
      "userId": "212069869435631201",
      "userInitials": "E"
    },
    "projectId": "myproject",
    "type": "PROJECT_CREATED"
  },
  ...
]

List builds and deployments activities

Parameters
Name Type Required
commit string
buildGroupUid string
limit integer
offset integer
verbose boolean
shouldGroup boolean
type string
GET /projects/:projectId/activities/builds-deployments
Request
curl "https://api.wedeploy.com/projects/myproject/activities/builds-deployments" -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": "1474608905803",
    "id": "<UID>",
    "metadata": {
      "emailAddress": "email@domain.com",
      "emailAddressHash": "ZW1haWxAZG9tYWluLmNvbQ==",
      "userPhotoUrl": null,
      "projectId": "myproject",
      "userId": "212069869435631201",
      "userInitials": "E"
    },
    "projectId": "myproject",
    "type": "BUILD_STARTED"
  },
  ...
]

Get project activity

GET /projects/:projectId/activities/:id
Request
curl "https://api.wedeploy.com/projects/myproject/activities/180579269793175907" -u user@domain.com:pass
Response 200 OK
{
  "createdAt": "1474608905803",
  "id": "<UID>",
  "metadata": {
    "emailAddress": "email@domain.com",
    "emailAddressHash": "ZW1haWxAZG9tYWluLmNvbQ==",
    "userPhotoUrl": null,
    "projectId": "myproject",
    "userId": "212069869435631201",
    "userInitials": "E"
  },
  "projectId": "myproject",
  "type": "PROJECT_CREATED"
}

List user alerts

GET /alerts
Parameters
Name Type Required Options
unread boolean
type string user, projects
projectId string
Request
curl "https://api.wedeploy.com/alerts?unread=true" -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": 1532104627259,
    "metadata": {
      "message": "90% of your available transfer has been used.",
      "userId": "301156522137698482"
    },
    "projectUid": "_GLOBAL_",
    "readBy": [],
    "id": "301156538201055363",
    "type": "USER_QUOTA_TRANSFER_ALMOST",
    "projectId": "_GLOBAL_",
    "userId": "301156522137698482"
  },
  ...
]

Mark some alerts as read by user

PATCH /alerts/read
Parameters
Name Type Required
ids array false
Request
curl -X PATCH "https://api.wedeploy.com/alerts/read" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
      "ids": ["123", "456"]
     }'
Response 204 OK

Mark alerts for all user projects as read by user

PATCH /alerts/read
Parameters
Name Type Required
projectId string false
Request
curl -X PATCH "https://api.wedeploy.com/alerts/read" \
     -H "Content-Type: application/json" \
     -d '{
       "projectId": "projectId"
     }'
     -u teamuser@domain.com:pass
Response 204 OK

Mark all alerts as read by user

PATCH /alerts/read
Parameters
Name Type Required
all boolean false
Request
curl -X PATCH "https://api.wedeploy.com/alerts/read" \
     -H "Content-Type: application/json" \
     -d '{
       "all": true
     }'
     -u teamuser@domain.com:pass
Response 204 OK

Builds

List project builds

Parameters
Name Type Required Description
(deprecating) groupUid string
buildGroupUid string
serviceid string
limit integer
offset integer
verbose boolean
status string
overEnvironments boolean List all builds from all project environments
shouldGroup boolean Return builds grouped by buildGroupUid
GET /projects/:projectId/builds
Request
curl "https://api.wedeploy.com/projects/myproject/builds" -u user@domain.com:pass
Response 200 OK
[
  {
    image: "<BUILD_IMAGE>",
    metadata: {
      commit: "<BUILD_COMMIT>",
      commitAuthorEmail: "user@domain.com",
      commitAuthor: "User",
      commitBranch: "testing",
      commitMessage: "Update index.js",
      commitDate: "1499368678"
    },
    repository: "https://github.com/wedeploy/temp",
    type: "dockerfile",
    branch: "master",
    directory: "<BUILD_DIRECTORY>",
    createdAt: 1499379569854,
    id: "<UID>",
    serviceId: "service1",
    wedeploy: {
      id: "service1"
    },
    projectId: "myproject",
    buildGroupUid: "<BUILD_GROUP_UID>",
    status: "SUCCEEDED",
  },
  ...
]

Get project build

GET /projects/:projectId/builds/:id
Request
curl "https://api.wedeploy.com/projects/myproject/builds/232527117389994306" -u user@domain.com:pass
Response 200 OK
{
  image: "<BUILD_IMAGE>",
  metadata: {
    commit: "<BUILD_COMMIT>",
    commitAuthorEmail: "user@domain.com",
    commitMessage: "Update index.js",
    commitAuthor: "User",
    commitDate: "1499368678"
  },
  repository: "https://github.com/wedeploy/temp",
  type: "dockerfile",
  branch: "master",
  directory: "<BUILD_DIRECTORY>",
  createdAt: 1499379569854,
  id: "<UID>",
  serviceId: "service1",
  wedeploy: {
    id: "service1"
  },
  projectId: "myproject",
  buildGroupUid: "<BUILD_GROUP_UID>",
  status: "FAILED"
}

List ending deployment activities and associated build

Parameters
Name Type Required Description
status string
limit integer
offset integer
verbose boolean
overEnvironments boolean List all deployment activities from all project environments
shouldGroup boolean Return deployment activities grouped by deployGroupUid
GET /projects/:projectId/deployments
Request
curl "https://api.wedeploy.com/projects/myproject/deployments" -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": 1499368678,
    "metadata":
      {
        buildGroupUid,
        groupUid,
        image,
        imageHint,
        projectId,
        serviceId,
        emailAddress,
        userName,
        userPhotoUrl,
        userInitials,
      },
    "projectUid": '309890364454566095',
    "id": '309890364669170261',
    "type": 'DEPLOY_TIMEOUT',
    "projectId": '1',
    "build":
      {
        image: "<BUILD_IMAGE>",
        metadata: {
          commit: "<BUILD_COMMIT>",
          commitAuthorEmail: "user@domain.com",
          commitMessage: "Update index.js",
          commitAuthor: "User",
          commitDate: "1499368678"
        },
        repository: "https://github.com/wedeploy/temp",
        type: "dockerfile",
        branch: "master",
        directory: "<BUILD_DIRECTORY>",
        createdAt: 1499379569854,
        id: "<UID>",
        serviceId: "service1",
        wedeploy: {
          id: "service1"
        },
        projectId: "myproject",
        buildGroupUid: "<BUILD_GROUP_UID>",
        status: "SUCCEEDED",
      }
  },
  ...
]

Get Deployment Order

GET /projects/:projectId/builds/order/:buildGroupUid
Parameters
Name Type Options Required
format string pretty
Request
curl "https://api.wedeploy.com/projects/myproject/builds/order/jiax601" -u user@domain.com:pass
Response 200 OK
[
  data,
  auth,
  hosting
]

Environment Variables

Create or replace project service environment variable

PUT /projects/:projectId/services/:serviceId/environment-variables/:name
Request
curl -X PUT "https://api.wedeploy.com/projects/myproject/services/hosting/environment-variables/NAME" \
     -H "Content-Type: application/json" \
     -u user@domain.com:pass \
     -d $'{
  "value": "VALUE"
}'
Response 200 OK
(empty)

Replace project service environment variables

PUT /projects/:projectId/services/:serviceId/environment-variables
Request
curl -X PUT "https://api.wedeploy.com/projects/myproject/services/nodejs/environment-variables" \
     -H "Content-Type: application/json" \
     -u user@domain.com:pass \
     -d $'{
  "env": {
    "NODE_ENV": "production"
  },
}'
Response 200 OK
(empty)

List project service environment variables

GET /projects/:projectId/services/:serviceId/environment-variables
Request
curl "https://api.wedeploy.com/projects/myproject/services/hosting/environment-variables" -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": 1474607678754,
    "id": "<UID>",
    "name": "NAME",
    "projectId": "myproject",
    "serviceId": "hosting",
    "value": "VALUE"
  }
]

Get project service environment variable

GET /projects/:projectId/services/:serviceId/environment-variables/:name
Request
curl "https://api.wedeploy.com/projects/myproject/services/hosting/env/NAME" -u user@domain.com:pass
Response 200 OK
{
  "createdAt": 1474607678754,
  "id": "<UID>",
  "name": "NAME",
  "projectId": "myproject",
  "serviceId": "hosting",
  "value": "VALUE"
}

Delete project service environment variable

DELETE /projects/:projectId/services/:serviceId/environment-variables/:name
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/services/hosting/environment-variables/NAME" \
  -u user@domain.com:pass
Response 204 No Content
(empty)

Plans

List plans visible to user

GET /plans/user
Request
curl "https://api.wedeploy.com/plans/user"
Response 200 OK
{
  "free": {
    "projects": 2,
    "memory": 1024,
    "instances": 2,
    "description": "Free",
    "cpu": 1,
    "services": 2,
    "storage": 512,
    "buildsPerDay": 100,
    "customDomains": 0,
    "price": 0,
    "collaborators": 0,
    "planId": "free",
    "id": "280737384934014710",
    "support": false,
    "traffic": 1024,
    "canScale": false
  },
  "premium": {
    "projects": 20,
    "memory": 10240,
    "instances": 20,
    "description": "Premium",
    "cpu": 8,
    "services": 20,
    "storage": 51200,
    "buildsPerDay": 10000,
    "customDomains": 25,
    "price": 149,
    "collaborators": 20,
    "planId": "premium",
    "id": "280737384916914365",
    "support": false,
    "traffic": 122880,
    "canScale": true
  },
  "basic": {
    "projects": 3,
    "memory": 2048,
    "instances": 3,
    "description": "Basic",
    "cpu": 2,
    "services": 3,
    "storage": 2048,
    "buildsPerDay": 300,
    "customDomains": 3,
    "price": 12,
    "collaborators": 2,
    "planId": "basic",
    "id": "280737384942616917",
    "support": false,
    "traffic": 5120,
    "canScale": false
  },
  "standard": {
    "projects": 10,
    "memory": 6144,
    "instances": 10,
    "description": "Standard",
    "cpu": 4,
    "services": 10,
    "storage": 10240,
    "buildsPerDay": 1000,
    "customDomains": 10,
    "price": 49,
    "collaborators": 10,
    "planId": "standard",
    "id": "280737384944430630",
    "support": false,
    "traffic": 20480,
    "canScale": true
  }
}

Create Plan

POST /plans
Parameters

All byte-related quotas are in MB

Name Type Required Options
planId string yes
description string yes
projects number yes
services number yes
cpu number yes
memory number yes
traffic number yes
customDomains number yes
collaborators number yes
canScale boolean yes
instances number yes
storage number yes
buildsPerDay number yes
constraints array
support boolean yes
price number yes
Request
curl -X POST "https://api.wedeploy.com/plans?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass
     -d '{
      "planId": "free",
      "description": "Free",
      "projects": 2,
      "services": 2,
      "cpu": 1,
      "memory": 1024,
      "traffic": 1024,
      "customDomains": 0,
      "collaborators": 0,
      "canScale": false,
      "instances": 2,
      "storage": 512,
      "buildsPerDay": 100,
      "support": false,
      "price": 0
     }'
Response 200 OK
{
  "planId": "free",
  "description": "Free",
  "projects": 2,
  "services": 2,
  "cpu": 1,
  "memory": 1024,
  "traffic": 1024,
  "customDomains": 0,
  "collaborators": 0,
  "canScale": false,
  "instances": 2,
  "storage": 512,
  "buildsPerDay": 100,
  "support": false,
  "price": 0
},

Update Plan

PATCH /plans/:planId
Parameters

All byte-related quotas are in MB

Name Type Required Options
planId string
description string
projects number
services number
cpu number
memory number
traffic number
customDomains number
collaborators number
canScale boolean
instances number
storage number
buildsPerDay number
constraints array
support boolean
price number
Request
curl -X PATCH "https://api.wedeploy.com/plans/myplan?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
      "description": "Changed",
     }'
Response 200 OK
(empty)

Delete Plan

DELETE /plans/:planId
Request
curl -X DELETE "https://api.wedeploy.com/plans/myplan?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>"
     -u teamuser@domain.com:pass
Response 200 OK
(empty)

Catalog

List services catalog

Includes services specifically for that environment

GET /catalog/services
Request
curl "https://api.wedeploy.com/catalog/services"
Response 200 OK
{
  "wedeploy/auth": {
    "category": "WeDeploy™",
    "description": "Simple authentication with email\/password or third-party providers like GitHub and Google.",
    "image": "wedeploy\/auth",
    "name": "WeDeploy™ Auth",
    "state": "active",
    "versions": ["latest", "v1.5.0"]
  },
  ...
}

Authentication

For every request a token or credential may be extracted in the following order:

Source Key
Basic Authentication curl -u "username:password" "https://api.wedeploy.com"
Oauth2 Token (header) curl -H "Authorization: Bearer TOKEN" "https://api.wedeploy.com"
Oauth2 Token (cookie) curl -H "Cookie:access_token=TOKEN" "https://api.wedeploy.com"
MasterToken (header) curl -H "Authorization: MasterToken TOKEN" "https://api.wedeploy.com

Create a user

POST /user/create
Parameters
Name Type Required
email string
name string
password string
photoUrl string
Request
curl -X POST "https://api.wedeploy.com/user/create" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "user@domain.com",
  "name": "User Name",
  "password": "pass"
}'
Response 200 OK
{
  "createdAt": 1489019572853,
  "email": "user@domain.com",
  "id": "<UID>",
  "initials": "U",
  "invitationPending": false,
  "name": "User Name",
  "password": "<PASSWORD>",
  "photoUrl": null,
  "supportedScopes": []
}

Get logged user

GET /user
Request
curl "https://api.wedeploy.com/user" -u user@domain.com:pass
Response 200 OK
{
  "createdAt": 1489019572853,
  "email": "user@domain.com",
  "id": "<UID>",
  "initials": "E",
  "invitationPending": false,
  "name": "User Name"
}

Update logged user

PATCH /user/update
Parameters
Name Type Required
email string
name string
preferences object
Request
curl -X PATCH https://api.wedeploy.com/user/update \
     -H "Content-Type: application/json" \
     -u user@domain.com:pass \
     -d '{
        "email":"update@domain.com",
        "name":"Update Name",
        "preferences": {
          "alertsServiceStatusConsole": "true",
          "alertsServiceStatusEmail": "false",
          "alertsCpuUsageConsole": "true",
          "alertsCpuUsageEmail": "false",
          "alertsMemoryUsageConsole": "true",
          "alertsMemoryUsageEmail": "false",
          "alertsInstancesUsageConsole": "true",
          "alertsInstancesUsageEmail": "false",
          "alertsTransferUsageConsole": "true",
          "alertsTransferUsageEmail": "false",
          "alertsStorageUsageConsole": "true",
          "alertsStorageUsageEmail": "false"
        },
     }'
Response 200 OK
(empty)
Response 200 OK
(empty)

Send recover password email

POST /user/recover
Parameters
Name Type Required
email string
Request
curl -X POST "https://api.wedeploy.com/user/recover" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "user@domain.com"
}'
Response 200 OK
(empty)

Send email verification

POST /confirm
Parameters
Name Type Required
email string
Request
curl -X POST "https://api.wedeploy.com/confirm" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "user@domain.com"
}'
Response 200 OK
(empty)

Confirm email verification

GET /confirm
Parameters
Name Type Required
email string
confirmationToken string
ignoreRedirect boolean
Request
curl "https://api.wedeploy.com/confirm?email=user@domain.com&confirmationToken=12345"
Response 200 OK
(empty)

Reset user password

POST /user/reset
Parameters
Name Type Required
code string
email string
password string
Request
curl -X POST "https://api.wedeploy.com/user/reset" \
     -H "Content-Type: application/json" \
     -d $'{
  "code": "<RESET_CODE>",
  "email": "user@domain.com",
  "password": "newpass"
}'
Response 200 OK
(empty)

Send Reset Password Email (For api-auth)

POST /reset-password
Parameters
Name Type Required
resetCode string
email string
Request
curl -X POST "https://api.wedeploy.com/reset-password" \
     -H "Content-Type: application/json" \
     -d $'{
  "resetCode": "<RESET_CODE>",
  "email": "user@domain.com",
}'
Response 200 OK
(empty)

Send Reset Password Success Email (For api-auth)

POST /reset-password-success
Parameters
Name Type Required
email string
Request
curl -X POST "https://api.wedeploy.com/reset-password-success" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "user@domain.com",
}'
Response 200 OK
(empty)

Login user using credentials

POST /login
Parameters
Name Type Required
email string
password string
Request
curl -X POST "https://api.wedeploy.com/login" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "user@domain.com",
  "password": "pass"
}'
Response 200 OK
{
  "createdAt": 1489019572853,
  "email": "user@domain.com",
  "id": "<UID>",
  "initials": "E",
  "invitationPending": false,
  "name": "User name",
  "password": null,
  "photoUrl": null,
  "supportedScopes": [],
  "token": "TOKEN"
}

Login user using provider

GET /oauth/authorize
Parameters
Name Type Required
provider string
provider_scope string
redirect_uri string
scope string
Request
curl "https://api.wedeploy.com/oauth/authorize?provider=github&provider_scope=email&redirect_uri=http://myproject.com"
Response 302 Found

Logout user

GET /logout
Parameters
Name Type Required
redirect_uri string
Request
curl "https://api.wedeploy.com/logout" -u user@domain.com:pass
Response 200 OK
(empty)

Get token information

GET /oauth/tokeninfo
Parameters
Name Type Required
token string
Request
curl "https://api.wedeploy.com/oauth/tokeninfo?token=TOKEN"
Response 200 OK
{
  "access_token": "<TOKEN>",
  "expires_in": null,
  "refresh_token": null,
  "scope": null,
  "token_type": "bearer"
}

Revoke user token

GET /oauth/revoke
Parameters
Name Type Required
redirect_uri string
token string
Request
curl "https://api.wedeploy.com/oauth/revoke?token=TOKEN"
Response 200 OK
(empty)

Create user token (password)

POST /oauth/token
Parameters
Name Type Required
grant_type string
password string
username string
Request
curl -X POST "https://api.wedeploy.com/oauth/token" \
     -H "Content-Type: application/json" \
     -d $'{
  "grant_type": "password",
  "password": "pass",
  "username": "user@domain.com"
}'
Response 200 OK
{
  "access_token": "<TOKEN>",
  "expires_in": null,
  "refresh_token": null,
  "scope": null,
  "token_type": "bearer"
}

Create user token (code)

POST /oauth/token
Parameters
Name Type Required
code string
grant_type string
provider string
redirect_uri string
Request
curl -X POST "https://api.wedeploy.com/oauth/token?code=CODE&provider=github&redirect_uri=http://myproject.com" \
     -H "Content-Type: application/json" \
     -d $'{
  "code": "<CODE>",
  "grant_type": "authorization_code",
  "provider": "github"
}'
Response 200 OK
{
  "access_token": "<TOKEN>",
  "expires_in": null,
  "refresh_token": null,
  "scope": null,
  "token_type": "bearer"
}

Validators

Validate custom domains

GET /validators/projects/:projectId/services/:serviceId/custom-domains
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/projects/1/services/2/custom-domains?value=valid.wedeploy.com" -u user@domain.com:pass
Response 200 OK
(empty)

Validate email

GET /validators/email
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/email?value=email@domain.com" -u user@domain.com:pass
Response 200 OK
(empty)

Validate project collaborator

GET /validators/projects/:projectId/collaborator
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/projects/1/collaborator?value=1" -u user@domain.com:pass
Response 200 OK
(empty)

Validate account email

GET /validators/accounts/email
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/accounts/email?value=test@domain.com" -u user@domain.com:pass
Response 200 OK
(empty)

Validate project id

GET /validators/projects/id
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/projects/id?value=projectId" -u user@domain.com:pass
Response 200 OK
(empty)

Validate service id

GET /validators/projects/:projectId/services/id
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/projects/1/services/id?value=serviceId" -u user@domain.com:pass
Response 200 OK
(empty)

Validate required value

GET /validators/required
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/required?value=value"
Response 200 OK
(empty)

Hooks

Git Repository

POST /hooks/providers/:provider/build/:projectId/:masterToken?
Parameters
Name Type Required
ref string
repository string
Request
curl -X POST "https://api.wedeploy.com/hooks/providers/github/build/myproject/<OPTIONAL_PROJECT_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u user@domain.com:pass \
     -d $'{
  "ref": "refs/heads/master",
  "repository": {full_name: 'user/repo'},
}'
Response 200 OK
[
  {
    "cpu": 1.0,
    "createdAt": 1490054338701,
    "deployGroupUid": "<DEPLOY_GROUP_ID>",
    "health": "up",
    "id": "<UID>",
    "image": "wedeploy/hosting",
    "memory": 4096,
    "port": 80,
    "projectId": "myproject",
    "scale": 1,
    "serviceId": "hosting"
  },
  ...
]

Link Provider

GET /hooks/providers/:provider/oauth/link-provider
Parameters
Name Type Required
state string
code string
redirect_uri string
Request
curl "https://api.wedeploy.com/hooks/providers/Github/oauth/link-provider \
  ?state=<OAUTH_STATE> \
  &code=<OAUTH_CODE> \
  &redirect_uri=https://console.wedeploy.com/projects/:projectId/github"
Response 200 OK
(empty)

Realtime

Subscribe project activities

WS /subscribe/project/activities
Parameters
Name Type Required
accessToken string
projectId string

Subscribe user projects

WS /subscribe/user/projects
Parameters
Name Type Required
accessToken string

Subscribe project services

WS /subscribe/project/services
Parameters
Name Type Required
accessToken string
projectId string

Subscribe project service

WS /subscribe/project/service
Parameters
Name Type Required
accessToken string
projectId string
serviceId string

Metrics

Retrieve CPU metrics for service

Parameters
Name Type Required
period string
start string
end string
frequency string
order string
limit number
Request
curl "https://api.wedeploy.com/projects/myproject/services/myservice/metrics/cpu?period=10m&frequency=30s" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    time: 1504025885000,
    value: 0.0391573682,
    instance: 1
  },
  ...
]

Retrieve Memory metrics for service

Parameters
Name Type Required
period string
start string
end string
frequency string
order string
limit number
Request
curl "https://api.wedeploy.com/projects/myproject/services/myservice/metrics/memory?period=10m&frequency=30s" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    time: 1504025885000,
    value: 14401536,
    instance: 1
  },
  ...
]

Retrieve Traffic-In metrics for service

Parameters
Name Type Required
period string
start string
end string
frequency string
order string
limit number
Request
curl "https://api.wedeploy.com/projects/myproject/services/myservice/metrics/traffic/in?period=10m&frequency=30s" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    time: 1504025885000,
    value: 143,
    instance: 1
  },
  ...
]

Retrieve Traffic-Out metrics for service

Parameters
Name Type Required
period string
start string
end string
frequency string
order string
limit number
Request
curl "https://api.wedeploy.com/projects/myproject/services/myservice/metrics/traffic/out?period=10m&frequency=30s" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    time: 1504025885000,
    value: 143,
    instance: 1
  },
  ...
]

Retrieve Health metrics for service

Parameters
Name Type Required
period string
start string
end string
frequency string
order string
limit number
now boolean
Request
curl "https://api.wedeploy.com/projects/myproject/services/myservice/metrics/health?period=10m&frequency=30s" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    time: 1504025885000,
    value: 1,
    instance: 1
  },
  ...
]

Retrieve volume metrics for project

Request
curl "https://api.wedeploy.com/projects/myproject/metrics/volumes" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    "name": "283438694262688104-data",
    "path": "/var/lib/mysql",
    "files": 694,
    "directories": 5,
    "value": 134.155
  },
  ...
]

Usage

Retrieve account collaborator usage

GET /account/usage/collaborators
Request
curl "https://api.wedeploy.com/account/usage/collaborators" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 1,
  planTotal: 5,
  projects: [
    {
      projectId: "example",
      value: 1
    }
  ]
}

Retrieve account CPU usage

GET /account/usage/cpu
Request
curl "https://api.wedeploy.com/account/usage/cpu" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 0.5,
  planTotal: 1,
  services: [
    {
      projectId: "example",
      serviceId: "hosting",
      value: 0.5,
    }
  ]
}

Retrieve account custom domain usage

GET /account/usage/custom-domains
Request
curl "https://api.wedeploy.com/account/usage/custom-domains" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 1,
  planTotal: 5,
  services: [
    {
      serviceId: "hosting",
      projectId: "example",
      value: 1,
    }
  ]
}

Retrieve account instance usage

GET /account/usage/instances
Request
curl "https://api.wedeploy.com/account/usage/instances" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 1,
  planTotal: 2,
  services: [
    {
      serviceId: "hosting",
      projectId: "example",
      value: 1,
    }
  ]
}

Retrieve account memory usage

GET /account/usage/memory
Request
curl "https://api.wedeploy.com/account/usage/memory" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 512,
  planTotal: 1024,
  services: [
    {
      serviceId: "hosting",
      projectId: "example",
      value: 512,
    }
  ]
}

Retrieve account projects usage

GET /account/usage/projects
Request
curl "https://api.wedeploy.com/account/usage/projects" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 1,
  planTotal: 3,
}

Retrieve account support capability

GET /account/usage/support
Request
curl "https://api.wedeploy.com/account/usage/support" \
  -u user@domain.com:pass
Response 200 OK
{
  value: false,
}

Retrieve account scale capability

GET /account/usage/scale
Request
curl "https://api.wedeploy.com/account/usage/scale" \
  -u user@domain.com:pass
Response 200 OK
{
  value: true,
}

Retrieve account traffic usage

GET /account/usage/traffic
Request
curl "https://api.wedeploy.com/account/usage/traffic" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 4341653,
  planTotal: 1024000000,
  services: [
    {
      serviceId: "hosting",
      projectId: "example",
      value: 4341653,
    }
  ]
}

Retrieve account volume usage

GET /account/usage/volumes
Request
curl "https://api.wedeploy.com/account/usage/volumes" \
  -u user@domain.com:pass
Response 200 OK
{
  "value": 274240995,
  "planTotal": 1000,
  "services": [
    {
      "name": "283438694262688104-data",
      "path": "/var/lib/mysql",
      "files": 694,
      "directories": 5,
      "value": 274240995
    }
  ]
}

Retrieve all usages

GET /account/usage
Request
curl "https://api.wedeploy.com/account/usage" \
  -u user@domain.com:pass
Response 200 OK
{
  "collaborators": {
    "value": 0,
    "planTotal": 600,
    "projects": [
      {
        "projectId": "test1",
        "value": 0
      }
    ]
  },
  "cpu": {
    "value": 6,
    "planTotal": 300,
    "services": [
      {
        "projectId": "test1",
        "serviceId": "db",
        "value": 6
      }
    ]
  },
  "customDomains": {
    "value": 0,
    "planTotal": 600,
    "services": [
      {
        "projectId": "test1",
        "serviceId": "db",
        "value": 0
      }
    ]
  },
  "memory": {
    "value": 4096,
    "planTotal": 307200,
    "services": [
      {
        "projectId": "test1",
        "serviceId": "db",
        "value": 4096
      }
    ]
  },
  "projects": {
    "value": 1,
    "planTotal": 300
  },
  "instances": {
    "value": 1,
    "planTotal": 300,
    "services": [
      {
        "projectId": "test1",
        "serviceId": "db",
        "value": 1
      }
    ]
  },
  "traffic": {
    "value": 35785407.70634852,
    "planTotal": 10737418240000,
    "services": [
      {
        "projectId": "test1",
        "serviceId": "db",
        "value": 35785407.70634852
      }
    ]
  },
  "volumes": {
    "value": 274240995,
    "planTotal": 1000,
    "services": [
      {
        "name": "276399336844630531-data",
        "path": "/var/lib/mysql",
        "files": 694,
        "directories": 5,
        "value": 274240995
      }
    ]
  }
}

Retrieve top usage

GET /account/usage/top
Request
curl "https://api.wedeploy.com/account/usage/top" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 0.6666666666666666,
  planTotal: 1,
  services: [
    {
      projectId: "example",
      serviceId: "hosting",
      value: 0.3333333333333333
    },
    {
      projectId: "example",
      serviceId: "auth",
      value: 0.3333333333333333
    },
  ]
}

Billing

List current account subscription

GET /account/billing/subscriptions
Request
curl "https://api.wedeploy.com/account/billing/subscriptions" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    id: "sub_BRD6hMr5X9rPGS",
    planId: "free",
    status: "active",
    amount: 0,
    currency: "usd",
    interval: "month",
    intervalCount: 1,
    createdAt: 1505961871000,
    canceledAt: null,
    endedAt: null,
    currentPeriodEnd: 1508553871000,
    currentPeriodStart: 1505961871000,
    trialEnd: null,
    trialStart: null
  }
]

List invoices for account

GET /account/billing/invoices
Request
curl "https://api.wedeploy.com/account/billing/invoices" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    id: "in_1B4KfzErwzAsisk6abS3yUuJ",
    date: 1505961871000,
    lines: [
      {
        planId: "free",
        description: "WeDeploy Free",
        subtotal: 0,
        total: 0,
        amountDue: 0,
        currency: "usd",
        interval: "month",
        intervalCount: 1,
        trial: null,
        periodEnd: 1508553871000,
        periodStart: 1505961871000
      }
    ]
  }
  ...
]

Retrieve payment info for account

GET /account/billing/payment-info
Request
curl "https://api.wedeploy.com/account/billing/payment-info" \
  -u user@domain.com:pass
Response 200 OK
{
  brand: "Visa",
  last4: "4242",
  token: "tok_1B4KrxErwzAsisk6QCiNsdt2",
  type: "card"
}

Retrieve trial period for plan

GET /account/billing/trial-period/:planId
Request
curl "https://api.wedeploy.com/account/billing/trial-period/:planId" \
  -u user@domain.com:pass
Response 200 OK
{
  trialPeriod: 7
}

Update payment info for account

POST /account/billing/payment-info
Parameters
Name Type Required
stripeToken string
stripeTokenType string
shippingName string
shippingAddressCountry string
shippingAddressCountryCode string
shippingAddressZip string
shippingAddressLine1 string
shippingAddressCity string
shippingAddressStat string
Request
curl -X POST "https://api.wedeploy.com/account/billing/payment-info" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -u user@domain.com:pass \
  -d $'{
  "stripeToken": "tok_1B4L0ZErwzAsisk6GKGA4FHj",
  "stripeTokenType": "card"
  "shippingName": "Liferay",
  "shippingAddressCountry": "United States",
  "shippingAddressCountryCode": "US",
  "shippingAddressZip": "91765",
  "shippingAddressLine1": "1400 Montefino Ave",
  "shippingAddressCity": "Diamond Bar",
  "shippingAddressState": "91765",
}'
Response 200 OK
{
  customerPaymentType: "card",
  customerPaymentToken: "tok_1B4L0ZErwzAsisk6GKGA4FHj",
}

Subscribe to plan

POST /account/billing/subscribe
Parameters
Name Type Required
planId string
coupon string
Request
curl -X POST "https://api.wedeploy.com/account/billing/subscribe" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -u user@domain.com:pass \
  -d $'{
  "planId": "basic",
  "coupon": "DEVCON2017"
}'
Response 200 OK
{
  "subscriptionId": "sub_BRDbydjqmxaAdw"
}

Unsubscribe from plan

POST /account/billing/unsubscribe
Name Type Required
planId string
Request
curl -X POST "https://api.wedeploy.com/account/billing/unsubscribe" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -u user@domain.com:pass \
  -d $'{
  "planId": "basic"
}'
Response 200 OK
(empty)

Vpn

Connect to a vpn service

POST /projects/:projectId/vpn
Request
curl -X POST "https://api.wedeploy.com/projects/:projectId/vpn" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
            "host": "127.0.0.1:8090",
            "login": "the-login",
            "password": "the-password",
            "certificate": "-----BEGIN CERTIFICATE-----\nMIIDFzCCAf+gAwIBDQEBCwUAMBExDzANBgNV\n-----END CERTIFICATE-----"
     }'
Response 200 OK
{
  connected: true,
  host: "127.0.0.1:8090",
  login: "the-login",
  password: "the-password",
  certificate: "-----BEGIN CERTIFICATE-----\nMIIDFzCCAf+gAwIBDQEBCwUAMBExDzANBgNV\n-----END CERTIFICATE-----"
}

Disconnect vpn service

DELETE /projects/:projectId/vpn
Request
curl -X DELETE "https://api.wedeploy.com/projects/:projectId/vpn" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
Response 200 OK
{
 connected: false
}

Return vpn connection configurations

GET /projects/:projectId/vpn
Request
curl "https://api.wedeploy.com/projects/:projectId/vpn" -u teamuser@domain.com:pass
Response 200 OK
{
  connected: true,
  host: "127.0.0.1:8090",
  password: "123456",
  login: "the-login",
  certificate: "-----BEGIN CERTIFICATE-----\nMIIDFzCCAf+gAwIBDQEBCwUAMBExDzANBgNV\n-----END CERTIFICATE-----",
  forwardingPorts: [],
}

Maintenance vpn port forwarding

POST /projects/:projectId/vpn-forwarding
Request
curl -X POST "https://api.wedeploy.com/projects/:projectId/vpn-forwarding" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
       "forwarding":
        [
          {
            "host": "127.0.0.1",
            "port": 8090,
          },
          {
            "host": "127.0.0.1",
            "port": 8091,
          }
        ]
      }'
Response 200 OK
{
  connected: true,
  host: "127.0.0.1:8090",
  password: "123456",
  login: "the-login",
  certificate: "-----BEGIN CERTIFICATE-----\nMIIDFzCCAf+gAwIBDQEBCwUAMBExDzANBgNV\n-----END CERTIFICATE-----",
  forwardingPorts: [
    {
      host: "127.0.0.1",
      port: 8090,
      internalPort: 30125
    },
    {
      host: "127.0.0.1",
      port: 8091,
      internalPort: 30126
    }
  ]
}

Admin

List All of Collection

GET /admin/:collection/:id?

Examples:

GET /admin/activities/:id?
GET /admin/builds/:id?
GET /admin/envs/:id?
GET /admin/plans/:id?
GET /admin/projects/:id?
GET /admin/services/:id?
GET /admin/users/:id?
Parameters
Name Type Required Options
type string count
limit string
offset string
field string
order string asc, desc
Request
curl "https://api.wedeploy.com/admin/users?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" -u teamuser@domain.com:pass
Response 200 OK
[
  {
    "createdAt": 1489019572853,
    "email": "user@domain.com",
    "id": "<UID>",
    "initials": "E",
    "invitationPending": false,
    "name": "User Name"
  },
  ...
]

if type=count

{
  "count": 100,
}

List Health of all Services

GET /admin/health
Request
curl "https://api.wedeploy.com/admin/health?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" -u teamuser@domain.com:pass
Response 200 OK
[
  {
    node: {
      total: 1,
      up: 1
    },
    miscellaneous: {
      total: 0,
      up: 0
    },
    wedeploy/auth: {
      total: 1,
      up: 0
    },
    wedeploy/data: {
      total: 1,
      up: 0
    },
    wedeploy/email: {
      total: 0,
      up: 0
    },
    wedeploy/engine: {
      total: 0,
      up: 0
    },
    wedeploy/hosting: {
      total: 2,
      up: 2
    },
    wedeploy/liferay: {
      total: 0,
      up: 0
    }
  }
  ...
]

Retrieve system wide usage

GET /admin/usage
Request
curl "https://api.wedeploy.com/admin/usage?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" -u teamuser@domain.com:pass
Response 200 OK
{
  "cpu": 123,
  "memory": 204800,
  "customDomains": 100,
  "instances": 200,
  "collaborators": 25,
  "traffic": 231829384731,
  "storage": 102400005678,
}

Update Collection Document

PATCH /admin/:collection/:id?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>
Request
curl -X PATCH "https://api.wedeploy.com/admin/users/123?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
        "email":"update@domain.com",
        "name":"Updated Name",
        "supportedScopes": ["team"]
     }'
Response 200 OK
(empty)

Post Collection Document

POST /admin/:collection?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>
Request
curl -X POST "https://api.wedeploy.com/admin/projects?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
        "projectId": "myproject",
        "id": "5678",
        "collaborators": ["212069869435631201"]
     }'
Response 200 OK
{
  "collaborators": [
    "212069869435631201"
  ],
  "id": "5678",
  "projectId": "myproject",
}

Delete user

DELETE /admin/user/:userId?
Parameters
Name Type Required
email string
id string
Request
curl -X DELETE "https://api.wedeploy.com/admin/user/123?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -u teamuser@domain.com:pass
Response 204 No Content
(empty)

Delete collection

DELETE /admin/collection/:collection/:id/:field?

####DO NOT USE UNLESS YOU JUST NEED TO DELETE A DOCUMENT AND NOT THEIR RELATED ASSETS

FOR EXAMPLE, THIS WILL NOT DELETE THE SERVICES OF A PROJECT
Request
curl -X DELETE "https://api.wedeploy.com/admin/projects/123/ownerId?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -u teamuser@domain.com:pass
Response 200 OK
(empty)

Subscribe user to plan

POST /admin/billing/subscribe/user/:userId
Request
curl -X POST "https://api.wedeploy.com/admin/billing/subscribe/user/123?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
        "planId": "premium"
     }'
Response 200 OK
{
  "subscriptionId": "sub_BRDbydjqmxaAdw"
}

Retrieve user account usage by spec

GET /admin/usage/:spec/user/:userId
Request
curl -X GET "https://api.wedeploy.com/admin/usage/cpu/user/123?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass
Response 200 OK
{
  value: 0.5,
  planTotal: 1,
  services: [
    {
      projectId: "example",
      serviceId: "hosting",
      value: 0.5,
    }
  ]
}

Recover WeDeploy

POST /admin/wedeploy/recover
Request
curl -X POST "https://api.wedeploy.com/admin/wedeploy/recover?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass
Response 204 No Content
(empty)

CI Pipeline

There is a Jenkinsfile containing the information about how this project is built. There, we select a Jenkins slave node to execute the tasks, and then we define several stages for the pipeline:

  • Setup: we asure the machine has been configured properly, mainly node.
  • Install dependencies: we fetch all dependencies using NPM.
  • Start infrastructure: we start the local infrastructure
  • Test: we execute unit and integration tests in parallel against the XYZ environment. At the end of the test execution, the CI server will gather the test execution results.

Finally, when all previous stages have finished, we ensure that the infrastructure is shutdown properly.

Building the image

The build of the image has been delegated to the CI. A merge commit to master will update the current snapshot, following tag name convention:

Successfully tagged wedeploy/api:staging
Successfully tagged wedeploy/api:local
Successfully tagged wedeploy/api:4.5.2-20190329084603_942b49f4
Successfully tagged wedeploy/api:4.5.2

Tagging docker image

The wedeploy/api:local image can be tagged by running the ./tag-images.sh script. With it you can customize some parameters of the build:

variable description
IMAGE_PREFIX Configures the prefix of the image (defaults to wedeploy)
IMAGE_TAG Configures the tag of the image (defaults to staging)

For instance:

IMAGE_PREFIX=localhost:5000/cirocosta.co \
  IMAGE_TAG=dev \
  ./tag-images.sh


# Starting to tag image

#   FULL_NAME:              localhost:5000/cirocosta.co/api:dev
#   IMAGE_PREFIX:           localhost:5000/cirocosta.co
#   IMAGE_TAG:              dev
#   CONTEXT:                /Users/cirocosta/Development/wedeploy/api

Note 1.: In order to tag the docker images, it assumes you have previously built the current code with the tag local.

Publishing the image to Docker Hub

We advise against pushing local images in favour of letting the CI to do it. For that reason the push script has been removed from this repository. Instead, the CI will push the image in two scenarios:

  1. On merges to master: it will push a Docker tag following this tag name convention currentVersion-timestamp_shortHash. As an example: 4.5.2-20190227111212_abcdef.
  2. On git tags (api releases): it will push a Docker tag with the current version. The latest tag won't be updated. It's important to mention that the git tag value must go in-sync with project version.

If you are still interested in pushing from local, which is not a best practice, please follow Jenkinsfile instructions to build and push the image.

There is a ./package.json file with current version of the image. This value determines the tag of the Docker image representing the project. Please do not update it manually: use the available scripts instead.

Automated publish

Send a pull request to wedeploy/api Github repository, against master branch. At release time, a merge commit to master branch will produce that the CI server (Jenkins) pushes the Docker image with following tags:

wedeploy/api:staging
wedeploy/api:4.5.2-20190329084603_942b49f4

Manual release

If you still want to build, push and release the api images locally, please use the commands that are present in the Jenkinsfile, where you can clearly see which environment variables are affecting the build.

This is not recommended, as the publication of the image must be as much automated as possible, using the CI. First make sure that your "local" tag is in the desired state.
# Download release scripts
GITHUB_TOKEN='YOUR_GITHUB_TOKEN' ./.jenkins/main.sh --setup-machine
# Build images with proper tag convention
./.jenkins/main.sh --build-images
# Push snapshots to Docker Hub
DOCKER_USERNAME='YOUR_DOCKER_USER' DOCKER_PASSWORD='YOUR_DOCKER_PASSWORD' ./.jenkins/main.sh --push-images
# Push release to Docker Hub
DOCKER_USERNAME='YOUR_DOCKER_USER' DOCKER_PASSWORD='YOUR_DOCKER_PASSWORD' ./.jenkins/main.sh --release-images

Releasing the image

To release the api images using SEMVER, we are going to use mdelapenya/webump:1.0.0. Just execute the following shell script to perform the bump:

./bump.sh [major|minor|patch]

which will update the version present in the package.json in consequence. This will also create a git commit with the bump, and a git tag with the proper version. After pushing this git tag to the repository, the CI will execute the release process, which will read the current value of the version from the previous files, and use them as Docker tag. Then it will push the released image to Docker Hub, using the described above process for releasing.

IMPORTANT: You still have to go to Jenkins UI to manually trigger the build. Check out why here.

License

BSD-3-Clause © Liferay, Inc.

WeDeploy API

Control your WeDeploy cloud services via a simple RESTful api

Overview

This describes the resources that make up the official WeDeploy API v1. If you have any problems or requests please contact support. All API access is over HTTPS, and accessed from the https://api.wedeploy.com.

Table of Contents

Status

Get status

GET /
Parameters
Name Type Required Options
status string auth, data, email, storage, all
Request
curl "https://api.wedeploy.com/"
Response 200 OK
{
  version: "0.0.0",
  domains: {
    infrastructure: "wedeploy.com",
    service: "wedeploy.io"
  }
}
Request
curl "https://api.wedeploy.com/?status=all"
curl "https://api.wedeploy.com/?status=auth"
curl "https://api.wedeploy.com/?status=data"
curl "https://api.wedeploy.com/?status=email"
curl "https://api.wedeploy.com/?status=storage"
Response 200 OK
{
  status: "up"
}

Projects

Create a project

POST /projects
Parameters
Name Type Required
github Object
projectId string
environment boolean
metadata Object
Request
curl -X POST "https://api.wedeploy.com/projects" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "projectId": "myproject"
}'
Response 200 OK
{
  "collaborators": [
    "212069869435631201"
  ],
  "createdAt": 1490046559186,
  "github": {},
  "health": "healthy",
  "id": "<UID>",
  "invitations": {},
  "masterToken": "<MASTER_TOKEN>",
  "ownerId": "212069869435631201",
  "projectId": "myproject"
}

List projects

GET /projects
Parameters
Name Type Required Options
filter string allProjects, ownedProjects, contributedProjects
field string projectId, createdAt, latestActivity
order string asc, desc
listServices boolean
Request
curl "https://api.wedeploy.com/projects?filter=allProjects&field=projectId&order=desc&listServices=true" -u user@domain.com:pass
Response 200 OK
[
  {
    "collaborators": [
      "212069869435631201"
    ],
    "createdAt": 1490046559186,
    "github": {},
    "health": "healthy",
    "id": "<UID>",
    "invitations": {},
    "masterToken": "<MASTER_TOKEN>",
    "ownerId": "212069869435631201",
    "projectId": "myproject",
    "services": [...]
  }
]

Get a project

GET /projects/:projectId
Parameters
Name Type Required Options
listServices boolean
Request
curl "https://api.wedeploy.com/projects/myproject?listServices=true" -u user@domain.com:pass
Response 200 OK
{
  "collaborators": [
    "212069869435631201"
  ],
  "createdAt": 1490046559186,
  "github": {},
  "health": "healthy",
  "id": "<UID>",
  "invitations": {},
  "masterToken": "<MASTER_TOKEN>",
  "ownerId": "212069869435631201",
  "projectId": "myproject",
  "services": [...]
}

Update a project

PATCH /projects/:projectId/:masterToken?
Parameters
Name Type Required
github Object
metadata Object
Request
curl -X PATCH "https://api.wedeploy.com/projects/myproject/<PROJECT_MASTER_TOKEN>" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "github": {}
  "metadata": {
    "dynatraceId": 1234,
  }
}'
Response 200 OK
{
  "collaborators": [
    "212069869435631201"
  ],
  "createdAt": 1490046559186,
  "github": {},
  "health": "healthy",
  "id": "<UID>",
  "invitations": {},
  "masterToken": "<MASTER_TOKEN>",
  "ownerId": "212069869435631201",
  "projectId": "myproject"
}

Delete a project

DELETE /projects/:projectId
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject" -u user@domain.com:pass
Response 204 No Content
(empty)

Build project services

POST /projects/:projectId/build
Parameters
Name Type Required
deploy boolean
provider string
repository string
masterToken string
wedeployGitBranch string
wedeployJsons Object
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/build" \
     -H "Content-Type: application/json" \
     -d $'{
  "masterToken": "<PROJECT_MASTER_TOKEN>",
  "provider": "github",
  "repository": "https://github.com/wedeploy/demo-ghost",
  "wedeployJsons": {
    "ui": {
      "cpu": "0.75"
    }
  }
}'
Response 200 OK
[
  {
    "cpu": 1.0,
    "createdAt": 1490054338701,
    "buildGroupUid": "<BUILD_GROUP_ID>",
    "deployGroupUid": "<DEPLOY_GROUP_ID>",
    "groupUid": "<DEPLOY_GROUP_ID>",
    "health": "up",
    "id": "<UID>",
    "image": "wedeploy/hosting",
    "memory": 4096,
    "port": 80,
    "projectId": "myproject",
    "scale": 1,
    "serviceId": "hosting"
  },
  ...
]

Deploy or Promote project services

POST /projects/:projectId/deploy
Parameters
Name Type Required
(deprecating) groupUid string
buildGroupUid string X
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/deploy" \
     -H "Content-Type: application/json" \
     -d $'{
  "buildGroupUid": "1",
}'
Response 200 OK
(empty)

Transfer project

POST /projects/:projectId/transfer
Parameters
Name Type Required
userId string
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/transfer" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "userId": "1"
}'
Response 200 OK
(empty)

Copy project services to child project

POST /projects/:projectId/copy
Parameters
Name Type Required
destinationProjectId string
wedeployJsons Object
Request
curl -X POST "https://api.wedeploy.com/projects/example/copy" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "destinationProjectId": "example-dev",
  "wedeployJsons": {
    "ui": {
      "cpu": "0.75",
    }
  }
}'
Response 200 OK
[
  {
    "image": "wedeploy/hosting",
    "memory": 1365.3333,
    "projectUid": "284690249352078105",
    "internalPort": 45594,
    "volumes": {},
    "cpu": 0.75,
    "health": "none",
    "scale": 1,
    "zeroDowntime": true,
    "constraints": [],
    "dependencies": [],
    "createdAt": 1524252889735,
    "customDomains": [],
    "port": 80,
    "healthCheck": { startPeriod: 1, retries: 10, interval: 5, timeout: 5 },
    "id": "284690250138355225",
    "serviceId": "ui",
    "projectId": "example-dev",
    "groupUid": "rwq3ih2"
  },
  ...
]

List project logs

GET /projects/:projectId/logs

Parameters

Name Type Required
serviceId string
start integer
end integer
limit integer
level integer
build boolean
download boolean
Request
curl "https://api.wedeploy.com/projects/myproject/logs" -u user@domain.com:pass
Response 200 OK
[
  {
    "buildUid": null,
    "containerId": "serviceId",
    "containerUid": "<CONTAINER_UID>",
    "deployUid": "<DEPLOY_UID>",
    "level": 6,
    "message": "A line of the log...",
    "projectId": "myproject",
    "timestamp": "1487022020949",
    "uid": "<UID>"
  },
  ...
]

Invite project collaborator

POST /projects/:projectId/invite
Parameters
Name Type Required
email string ✓ (exclusive)
userId string ✓ (exclusive)
role string
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/invite" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "email@domain.com"
  "role": "guest",
}'
Response 200 OK
(empty)

Accept project collaborator invitation

GET /projects/:projectId/invite
Parameters
Name Type Required
email string
invitationToken string
Request
curl "https://api.wedeploy.com/projects/myproject/invite?email=email@domain.com&invitationToken=INVITATION_TOKEN" -u user@domain.com:pass
Response 200 OK
(empty)

Delete project collaborator invitation

DELETE /projects/:projectId/invite
Parameters
Name Type Required
email string
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/invite?email=email@domain.com" -u user@domain.com:pass
Response 204 No Content
(empty)

Suggest project collaborator

GET /projects/:projectId/invite/suggestion
Parameters
Name Type Required
keyword string
limit integer
Request
curl "https://api.wedeploy.com/projects/myproject/invite/suggestion?keyword=user" -u user@domain.com:pass
Response 200 OK
[
  {
    "id": "<UID>",
    "initials": "U",
    "name": "User A",
    "email": "usera@domain.com",
    "emailHash": "3bc81bc52e7f209c3455af320abeee00"
  },
  {
    "id": "<UID>",
    "initials": "U",
    "name": "User B",
    "email": "userb@domain.com",
    "emailHash": "ed076488b22b5359d7ffb16b8e30caed"
  }
]

Delete project collaborator

DELETE /projects/:projectId/collaborators/:id
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/collaborators/1" -u user@domain.com:pass
Response 204 No Content
(empty)

Get project collaborators

GET /projects/:projectId/collaborators
Request
curl "https://api.wedeploy.com/projects/myproject/collaborators"
     -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": 1489019572853,
    "email": "user@domain.com",
    "id": "<UID>",
    "initials": "E",
    "invitationPending": false,
    "name": "User Name"
  },
  ...
]

Link project git provider

POST /projects/:projectId/link-provider
Parameters
Name Type Required
provider string
providerToken string
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/link-provider" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "provider": "github",
  "providerToken": "<GITHUB_TOKEN>"
}'
Response 200 OK
(empty)

Unlink project git provider

DELETE /projects/:projectId/link-provider
Parameters
Name Type Required
provider string
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/link-provider?provider=github" -u user@domain.com:pass
Response 204 No Content
(empty)

Link project git repository

POST /projects/:projectId/link-repository
Parameters
Name Type Required
branch string
provider string
repository string
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/link-repository" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "branch": "master",
  "provider": "github",
  "repository": "user/myproject"
}'
Response 200 OK
(empty)

Unlink project git repository

DELETE /projects/:projectId/link-repository
Parameters
Name Type Required
provider string
providerHookId string
providerToken string
repository string
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/link-repository?provider=github&providerToken=TOKEN&providerHookId=HOOK_ID" -u user@domain.com:pass
Response 204 No Content
(empty)

Change Collaborator Project Role

PATCH /projects/:projectId/collaborator-role
Parameters
Name Type Required
collaboratorId string
role string
Request
curl -X PATCH "https://api.wedeploy.com/projects/myProject/collaborator-role" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -u user@domain.com:pass \
  -d $'{
    "collaboratorId": "12345678",
    "role": "guest"
  }'
Response 204 No Content
(empty)

Services

Create project service

POST /projects/:projectId/services
Parameters
Name Type Required
command array
constraints array
cpu integer
customDomains array
env Object
image string
imageHint string
memory integer
port integer
public boolean
scale integer
serviceId string
volume string
recipeType string
skipGenerateCertificate boolean
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/services" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "cpu": 1.0,
  "customDomains": [
    "myproject.com",
    "www.myproject.com"
  ],
  "env": {
    "NODE_ENV": "production"
  },
  "image": "wedeploy/hosting",
  "memory": 4096,
  "port": 80,
  "public": true,
  "scale": 1,
  "serviceId": "hosting",
  "volume": "/shared"
}'
Response 200 OK
{
  "cpu": 1.0,
  "createdAt": 1490054338701,
  "customDomains": [
    "myproject.com",
    "www.myproject.com"
  ],
  "health": "up",
  "id": "<UID>",
  "image": "wedeploy/hosting",
  "memory": 4096,
  "port": 80,
  "public": true,
  "projectId": "myproject",
  "scale": 1,
  "serviceId": "hosting",
  "volume": "/shared"
}

List project services

GET /projects/:projectId/services
Request
curl "https://api.wedeploy.com/projects/myproject/services" -u user@domain.com:pass
Response 200 OK
[
  {
    "cpu": 1.0,
    "createdAt": 1490054338701,
    "customDomains": [
      "myproject.com",
      "www.myproject.com"
    ],
    "health": "up",
    "id": "<UID>",
    "image": "wedeploy/hosting",
    "memory": 4096,
    "port": 80,
    "projectId": "myproject",
    "scale": 1,
    "serviceId": "hosting"
  }
]

Get project service

GET /projects/:projectId/services/:serviceId
Request
curl "https://api.wedeploy.com/projects/myproject/services/hosting" -u user@domain.com:pass
Response 200 OK
{
  "cpu": 1.0,
  "createdAt": 1490054338701,
  "health": "up",
  "customDomains": [
    "myproject.com",
    "www.myproject.com"
  ],
  "id": "<UID>",
  "image": "wedeploy/hosting",
  "memory": 4096,
  "port": 80,
  "projectId": "myproject",
  "scale": 1,
  "serviceId": "hosting"
}

Delete project service

DELETE /projects/:projectId/services/:serviceId
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/services/hosting" -u user@domain.com:pass
Response 204 No Content
(empty)

Restart project service

POST /projects/:projectId/services/:serviceId/restart
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/services/hosting/restart" -u user@domain.com:pass
Response 200 OK
(empty)

Stop project service

PATCH /projects/:projectId/services/:serviceId/stop
Request
curl -X PATCH "https://api.wedeploy.com/projects/myproject/services/hosting/stop" -u user@domain.com:pass
Response 200 OK
(empty)

List project service logs

GET /projects/:projectId/services/:serviceId/logs

Parameters

Name Type Required
start integer
end integer
limit integer
level integer
build boolean
download boolean
Request
curl "https://api.wedeploy.com/projects/myproject/services/hosting/logs" -u user@domain.com:pass
Response 200 OK
[
  {
    "buildUid": null,
    "containerId": "hosting",
    "containerUid": "<CONTAINER_UID>",
    "deployUid": "<DEPLOY_UID>",
    "level": 6,
    "message": "A line of the log...",
    "projectId": "myproject",
    "timestamp": "1487022020949",
    "uid": "<UID>"
  },
  ...
]

List project service instances

GET /projects/:projectId/services/:serviceId/instances
Request
curl "https://api.wedeploy.com/projects/myproject/services/hosting/instances" -u user@domain.com:pass
Response 200 OK
[
  {
  "createdAt": "2019-02-11T13:35:31.8960205Z",
  "containerId": "87bbb217b0f73c304dbd60291c6ecca1de9a62acaf098a01a501fa076e0c79cd",
  "state": "running",
  "taskId": "su8zo1bdng6ggbdb2kg4sl4xy"
  }
  ...
]

Replace project service custom domains

PUT /projects/:projectId/services/:serviceId/custom-domains
Parameters
Name Type Required
value array
skipGenerateCertificate boolean
skipAddDnsRecords boolean
Request
curl -X PUT "https://api.wedeploy.com/projects/myproject/services/hosting/custom-domains" -u user@domain.com:pass \
     -H "Content-Type: application/json" \
     -d $'{
  "value": [
    "myproject.com",
    "www.myproject.com"
  ]
}'
Response 200 OK

Update project service scale properties

PATCH /projects/:projectId/services/:serviceId/scale
Parameters
Name Type Required Description
difference int scale will increase/decrease by difference
value int scale will be replaced by value
canAutoscale boolean turn on/off autoscaling capability
Request
curl -X PATCH "https://api.wedeploy.com/projects/myproject/services/myservice/scale" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -u user@domain.com:pass \
  -d '{
    "scale": 2,
    "canAutoscale": true
  }'
Response 204 No Content
(empty)

Create project service integration activities

POST /projects/:projectId/services/:serviceId/integrations
Parameters
Name Type Required
type string
masterToken string
metadata Object
Request
curl -X POST "https://api.wedeploy.com/projects/myproject/services/myservice/integrations" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d '{
    "type": "CI_STARTED",
    "masterToken": <PROJECT_MASTER_TOKEN>,
    "metadata": {
      "jenkinsURL": "www.jenkins.com"
    }
  }'
Response 200 OK
{
  createdAt: 1531525927705,
  metadata: {
    projectId: 'myproject',
    serviceId: 'myservice',
    integrationType: 'CI_STARTED'
    jenkinsURL: 'www.jenkins.com'
  },
  projectUid: '299942973016451145',
  id: '299942976036258986',
  type: 'INTEGRATION',
  projectId: 'myproject',
  userId: '_GLOBAL_'
}

Activities

List project activities

Parameters
Name Type Required Options
commit string
(deprecating) groupUid string
buildGroupUid string
limit integer
offset integer
type string
order string 'asc' (default), 'desc'
GET /projects/:projectId/activities
Request
curl "https://api.wedeploy.com/projects/myproject/activities" -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": "1474608905803",
    "id": "<UID>",
    "metadata": {
      "emailAddress": "email@domain.com",
      "emailAddressHash": "ZW1haWxAZG9tYWluLmNvbQ==",
      "userPhotoUrl": null,
      "projectId": "myproject",
      "userId": "212069869435631201",
      "userInitials": "E"
    },
    "projectId": "myproject",
    "type": "PROJECT_CREATED"
  },
  ...
]

List builds and deployments activities

Parameters
Name Type Required
commit string
buildGroupUid string
limit integer
offset integer
verbose boolean
shouldGroup boolean
type string
GET /projects/:projectId/activities/builds-deployments
Request
curl "https://api.wedeploy.com/projects/myproject/activities/builds-deployments" -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": "1474608905803",
    "id": "<UID>",
    "metadata": {
      "emailAddress": "email@domain.com",
      "emailAddressHash": "ZW1haWxAZG9tYWluLmNvbQ==",
      "userPhotoUrl": null,
      "projectId": "myproject",
      "userId": "212069869435631201",
      "userInitials": "E"
    },
    "projectId": "myproject",
    "type": "BUILD_STARTED"
  },
  ...
]

Get project activity

GET /projects/:projectId/activities/:id
Request
curl "https://api.wedeploy.com/projects/myproject/activities/180579269793175907" -u user@domain.com:pass
Response 200 OK
{
  "createdAt": "1474608905803",
  "id": "<UID>",
  "metadata": {
    "emailAddress": "email@domain.com",
    "emailAddressHash": "ZW1haWxAZG9tYWluLmNvbQ==",
    "userPhotoUrl": null,
    "projectId": "myproject",
    "userId": "212069869435631201",
    "userInitials": "E"
  },
  "projectId": "myproject",
  "type": "PROJECT_CREATED"
}

List user alerts

GET /alerts
Parameters
Name Type Required Options
unread boolean
type string user, projects
projectId string
Request
curl "https://api.wedeploy.com/alerts?unread=true" -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": 1532104627259,
    "metadata": {
      "message": "90% of your available transfer has been used.",
      "userId": "301156522137698482"
    },
    "projectUid": "_GLOBAL_",
    "readBy": [],
    "id": "301156538201055363",
    "type": "USER_QUOTA_TRANSFER_ALMOST",
    "projectId": "_GLOBAL_",
    "userId": "301156522137698482"
  },
  ...
]

Mark some alerts as read by user

PATCH /alerts/read
Parameters
Name Type Required
ids array false
Request
curl -X PATCH "https://api.wedeploy.com/alerts/read" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
      "ids": ["123", "456"]
     }'
Response 204 OK

Mark alerts for all user projects as read by user

PATCH /alerts/read
Parameters
Name Type Required
projectId string false
Request
curl -X PATCH "https://api.wedeploy.com/alerts/read" \
     -H "Content-Type: application/json" \
     -d '{
       "projectId": "projectId"
     }'
     -u teamuser@domain.com:pass
Response 204 OK

Mark all alerts as read by user

PATCH /alerts/read
Parameters
Name Type Required
all boolean false
Request
curl -X PATCH "https://api.wedeploy.com/alerts/read" \
     -H "Content-Type: application/json" \
     -d '{
       "all": true
     }'
     -u teamuser@domain.com:pass
Response 204 OK

Builds

List project builds

Parameters
Name Type Required Description
(deprecating) groupUid string
buildGroupUid string
serviceid string
limit integer
offset integer
verbose boolean
status string
overEnvironments boolean List all builds from all project environments
shouldGroup boolean Return builds grouped by buildGroupUid
GET /projects/:projectId/builds
Request
curl "https://api.wedeploy.com/projects/myproject/builds" -u user@domain.com:pass
Response 200 OK
[
  {
    image: "<BUILD_IMAGE>",
    metadata: {
      commit: "<BUILD_COMMIT>",
      commitAuthorEmail: "user@domain.com",
      commitAuthor: "User",
      commitBranch: "testing",
      commitMessage: "Update index.js",
      commitDate: "1499368678"
    },
    repository: "https://github.com/wedeploy/temp",
    type: "dockerfile",
    branch: "master",
    directory: "<BUILD_DIRECTORY>",
    createdAt: 1499379569854,
    id: "<UID>",
    serviceId: "service1",
    wedeploy: {
      id: "service1"
    },
    projectId: "myproject",
    buildGroupUid: "<BUILD_GROUP_UID>",
    status: "SUCCEEDED",
  },
  ...
]

Get project build

GET /projects/:projectId/builds/:id
Request
curl "https://api.wedeploy.com/projects/myproject/builds/232527117389994306" -u user@domain.com:pass
Response 200 OK
{
  image: "<BUILD_IMAGE>",
  metadata: {
    commit: "<BUILD_COMMIT>",
    commitAuthorEmail: "user@domain.com",
    commitMessage: "Update index.js",
    commitAuthor: "User",
    commitDate: "1499368678"
  },
  repository: "https://github.com/wedeploy/temp",
  type: "dockerfile",
  branch: "master",
  directory: "<BUILD_DIRECTORY>",
  createdAt: 1499379569854,
  id: "<UID>",
  serviceId: "service1",
  wedeploy: {
    id: "service1"
  },
  projectId: "myproject",
  buildGroupUid: "<BUILD_GROUP_UID>",
  status: "FAILED"
}

List ending deployment activities and associated build

Parameters
Name Type Required Description
status string
limit integer
offset integer
verbose boolean
overEnvironments boolean List all deployment activities from all project environments
shouldGroup boolean Return deployment activities grouped by deployGroupUid
GET /projects/:projectId/deployments
Request
curl "https://api.wedeploy.com/projects/myproject/deployments" -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": 1499368678,
    "metadata":
      {
        buildGroupUid,
        groupUid,
        image,
        imageHint,
        projectId,
        serviceId,
        emailAddress,
        userName,
        userPhotoUrl,
        userInitials,
      },
    "projectUid": '309890364454566095',
    "id": '309890364669170261',
    "type": 'DEPLOY_TIMEOUT',
    "projectId": '1',
    "build":
      {
        image: "<BUILD_IMAGE>",
        metadata: {
          commit: "<BUILD_COMMIT>",
          commitAuthorEmail: "user@domain.com",
          commitMessage: "Update index.js",
          commitAuthor: "User",
          commitDate: "1499368678"
        },
        repository: "https://github.com/wedeploy/temp",
        type: "dockerfile",
        branch: "master",
        directory: "<BUILD_DIRECTORY>",
        createdAt: 1499379569854,
        id: "<UID>",
        serviceId: "service1",
        wedeploy: {
          id: "service1"
        },
        projectId: "myproject",
        buildGroupUid: "<BUILD_GROUP_UID>",
        status: "SUCCEEDED",
      }
  },
  ...
]

Get Deployment Order

GET /projects/:projectId/builds/order/:buildGroupUid
Parameters
Name Type Options Required
format string pretty
Request
curl "https://api.wedeploy.com/projects/myproject/builds/order/jiax601" -u user@domain.com:pass
Response 200 OK
[
  data,
  auth,
  hosting
]

Environment Variables

Create or replace project service environment variable

PUT /projects/:projectId/services/:serviceId/environment-variables/:name
Request
curl -X PUT "https://api.wedeploy.com/projects/myproject/services/hosting/environment-variables/NAME" \
     -H "Content-Type: application/json" \
     -u user@domain.com:pass \
     -d $'{
  "value": "VALUE"
}'
Response 200 OK
(empty)

Replace project service environment variables

PUT /projects/:projectId/services/:serviceId/environment-variables
Request
curl -X PUT "https://api.wedeploy.com/projects/myproject/services/nodejs/environment-variables" \
     -H "Content-Type: application/json" \
     -u user@domain.com:pass \
     -d $'{
  "env": {
    "NODE_ENV": "production"
  },
}'
Response 200 OK
(empty)

List project service environment variables

GET /projects/:projectId/services/:serviceId/environment-variables
Request
curl "https://api.wedeploy.com/projects/myproject/services/hosting/environment-variables" -u user@domain.com:pass
Response 200 OK
[
  {
    "createdAt": 1474607678754,
    "id": "<UID>",
    "name": "NAME",
    "projectId": "myproject",
    "serviceId": "hosting",
    "value": "VALUE"
  }
]

Get project service environment variable

GET /projects/:projectId/services/:serviceId/environment-variables/:name
Request
curl "https://api.wedeploy.com/projects/myproject/services/hosting/env/NAME" -u user@domain.com:pass
Response 200 OK
{
  "createdAt": 1474607678754,
  "id": "<UID>",
  "name": "NAME",
  "projectId": "myproject",
  "serviceId": "hosting",
  "value": "VALUE"
}

Delete project service environment variable

DELETE /projects/:projectId/services/:serviceId/environment-variables/:name
Request
curl -X DELETE "https://api.wedeploy.com/projects/myproject/services/hosting/environment-variables/NAME" \
  -u user@domain.com:pass
Response 204 No Content
(empty)

Plans

List plans visible to user

GET /plans/user
Request
curl "https://api.wedeploy.com/plans/user"
Response 200 OK
{
  "free": {
    "projects": 2,
    "memory": 1024,
    "instances": 2,
    "description": "Free",
    "cpu": 1,
    "services": 2,
    "storage": 512,
    "buildsPerDay": 100,
    "customDomains": 0,
    "price": 0,
    "collaborators": 0,
    "planId": "free",
    "id": "280737384934014710",
    "support": false,
    "traffic": 1024,
    "canScale": false
  },
  "premium": {
    "projects": 20,
    "memory": 10240,
    "instances": 20,
    "description": "Premium",
    "cpu": 8,
    "services": 20,
    "storage": 51200,
    "buildsPerDay": 10000,
    "customDomains": 25,
    "price": 149,
    "collaborators": 20,
    "planId": "premium",
    "id": "280737384916914365",
    "support": false,
    "traffic": 122880,
    "canScale": true
  },
  "basic": {
    "projects": 3,
    "memory": 2048,
    "instances": 3,
    "description": "Basic",
    "cpu": 2,
    "services": 3,
    "storage": 2048,
    "buildsPerDay": 300,
    "customDomains": 3,
    "price": 12,
    "collaborators": 2,
    "planId": "basic",
    "id": "280737384942616917",
    "support": false,
    "traffic": 5120,
    "canScale": false
  },
  "standard": {
    "projects": 10,
    "memory": 6144,
    "instances": 10,
    "description": "Standard",
    "cpu": 4,
    "services": 10,
    "storage": 10240,
    "buildsPerDay": 1000,
    "customDomains": 10,
    "price": 49,
    "collaborators": 10,
    "planId": "standard",
    "id": "280737384944430630",
    "support": false,
    "traffic": 20480,
    "canScale": true
  }
}

Create Plan

POST /plans
Parameters

All byte-related quotas are in MB

Name Type Required Options
planId string yes
description string yes
projects number yes
services number yes
cpu number yes
memory number yes
traffic number yes
customDomains number yes
collaborators number yes
canScale boolean yes
instances number yes
storage number yes
buildsPerDay number yes
constraints array
support boolean yes
price number yes
Request
curl -X POST "https://api.wedeploy.com/plans?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass
     -d '{
      "planId": "free",
      "description": "Free",
      "projects": 2,
      "services": 2,
      "cpu": 1,
      "memory": 1024,
      "traffic": 1024,
      "customDomains": 0,
      "collaborators": 0,
      "canScale": false,
      "instances": 2,
      "storage": 512,
      "buildsPerDay": 100,
      "support": false,
      "price": 0
     }'
Response 200 OK
{
  "planId": "free",
  "description": "Free",
  "projects": 2,
  "services": 2,
  "cpu": 1,
  "memory": 1024,
  "traffic": 1024,
  "customDomains": 0,
  "collaborators": 0,
  "canScale": false,
  "instances": 2,
  "storage": 512,
  "buildsPerDay": 100,
  "support": false,
  "price": 0
},

Update Plan

PATCH /plans/:planId
Parameters

All byte-related quotas are in MB

Name Type Required Options
planId string
description string
projects number
services number
cpu number
memory number
traffic number
customDomains number
collaborators number
canScale boolean
instances number
storage number
buildsPerDay number
constraints array
support boolean
price number
Request
curl -X PATCH "https://api.wedeploy.com/plans/myplan?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
      "description": "Changed",
     }'
Response 200 OK
(empty)

Delete Plan

DELETE /plans/:planId
Request
curl -X DELETE "https://api.wedeploy.com/plans/myplan?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>"
     -u teamuser@domain.com:pass
Response 200 OK
(empty)

Catalog

List services catalog

Includes services specifically for that environment

GET /catalog/services
Request
curl "https://api.wedeploy.com/catalog/services"
Response 200 OK
{
  "wedeploy/auth": {
    "category": "WeDeploy™",
    "description": "Simple authentication with email\/password or third-party providers like GitHub and Google.",
    "image": "wedeploy\/auth",
    "name": "WeDeploy™ Auth",
    "state": "active",
    "versions": ["latest", "v1.5.0"]
  },
  ...
}

Authentication

For every request a token or credential may be extracted in the following order:

Source Key
Basic Authentication curl -u "username:password" "https://api.wedeploy.com"
Oauth2 Token (header) curl -H "Authorization: Bearer TOKEN" "https://api.wedeploy.com"
Oauth2 Token (cookie) curl -H "Cookie:access_token=TOKEN" "https://api.wedeploy.com"
MasterToken (header) curl -H "Authorization: MasterToken TOKEN" "https://api.wedeploy.com

Create a user

POST /user/create
Parameters
Name Type Required
email string
name string
password string
photoUrl string
Request
curl -X POST "https://api.wedeploy.com/user/create" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "user@domain.com",
  "name": "User Name",
  "password": "pass"
}'
Response 200 OK
{
  "createdAt": 1489019572853,
  "email": "user@domain.com",
  "id": "<UID>",
  "initials": "U",
  "invitationPending": false,
  "name": "User Name",
  "password": "<PASSWORD>",
  "photoUrl": null,
  "supportedScopes": []
}

Get logged user

GET /user
Request
curl "https://api.wedeploy.com/user" -u user@domain.com:pass
Response 200 OK
{
  "createdAt": 1489019572853,
  "email": "user@domain.com",
  "id": "<UID>",
  "initials": "E",
  "invitationPending": false,
  "name": "User Name"
}

Update logged user

PATCH /user/update
Parameters
Name Type Required
email string
name string
preferences object
Request
curl -X PATCH https://api.wedeploy.com/user/update \
     -H "Content-Type: application/json" \
     -u user@domain.com:pass \
     -d '{
        "email":"update@domain.com",
        "name":"Update Name",
        "preferences": {
          "alertsServiceStatusConsole": "true",
          "alertsServiceStatusEmail": "false",
          "alertsCpuUsageConsole": "true",
          "alertsCpuUsageEmail": "false",
          "alertsMemoryUsageConsole": "true",
          "alertsMemoryUsageEmail": "false",
          "alertsInstancesUsageConsole": "true",
          "alertsInstancesUsageEmail": "false",
          "alertsTransferUsageConsole": "true",
          "alertsTransferUsageEmail": "false",
          "alertsStorageUsageConsole": "true",
          "alertsStorageUsageEmail": "false"
        },
     }'
Response 200 OK
(empty)
Response 200 OK
(empty)

Send recover password email

POST /user/recover
Parameters
Name Type Required
email string
Request
curl -X POST "https://api.wedeploy.com/user/recover" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "user@domain.com"
}'
Response 200 OK
(empty)

Send email verification

POST /confirm
Parameters
Name Type Required
email string
Request
curl -X POST "https://api.wedeploy.com/confirm" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "user@domain.com"
}'
Response 200 OK
(empty)

Confirm email verification

GET /confirm
Parameters
Name Type Required
email string
confirmationToken string
ignoreRedirect boolean
Request
curl "https://api.wedeploy.com/confirm?email=user@domain.com&confirmationToken=12345"
Response 200 OK
(empty)

Reset user password

POST /user/reset
Parameters
Name Type Required
code string
email string
password string
Request
curl -X POST "https://api.wedeploy.com/user/reset" \
     -H "Content-Type: application/json" \
     -d $'{
  "code": "<RESET_CODE>",
  "email": "user@domain.com",
  "password": "newpass"
}'
Response 200 OK
(empty)

Send Reset Password Email (For api-auth)

POST /reset-password
Parameters
Name Type Required
resetCode string
email string
Request
curl -X POST "https://api.wedeploy.com/reset-password" \
     -H "Content-Type: application/json" \
     -d $'{
  "resetCode": "<RESET_CODE>",
  "email": "user@domain.com",
}'
Response 200 OK
(empty)

Send Reset Password Success Email (For api-auth)

POST /reset-password-success
Parameters
Name Type Required
email string
Request
curl -X POST "https://api.wedeploy.com/reset-password-success" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "user@domain.com",
}'
Response 200 OK
(empty)

Login user using credentials

POST /login
Parameters
Name Type Required
email string
password string
Request
curl -X POST "https://api.wedeploy.com/login" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "user@domain.com",
  "password": "pass"
}'
Response 200 OK
{
  "createdAt": 1489019572853,
  "email": "user@domain.com",
  "id": "<UID>",
  "initials": "E",
  "invitationPending": false,
  "name": "User name",
  "password": null,
  "photoUrl": null,
  "supportedScopes": [],
  "token": "TOKEN"
}

Login user using provider

GET /oauth/authorize
Parameters
Name Type Required
provider string
provider_scope string
redirect_uri string
scope string
Request
curl "https://api.wedeploy.com/oauth/authorize?provider=github&provider_scope=email&redirect_uri=http://myproject.com"
Response 302 Found

Logout user

GET /logout
Parameters
Name Type Required
redirect_uri string
Request
curl "https://api.wedeploy.com/logout" -u user@domain.com:pass
Response 200 OK
(empty)

Get token information

GET /oauth/tokeninfo
Parameters
Name Type Required
token string
Request
curl "https://api.wedeploy.com/oauth/tokeninfo?token=TOKEN"
Response 200 OK
{
  "access_token": "<TOKEN>",
  "expires_in": null,
  "refresh_token": null,
  "scope": null,
  "token_type": "bearer"
}

Revoke user token

GET /oauth/revoke
Parameters
Name Type Required
redirect_uri string
token string
Request
curl "https://api.wedeploy.com/oauth/revoke?token=TOKEN"
Response 200 OK
(empty)

Create user token (password)

POST /oauth/token
Parameters
Name Type Required
grant_type string
password string
username string
Request
curl -X POST "https://api.wedeploy.com/oauth/token" \
     -H "Content-Type: application/json" \
     -d $'{
  "grant_type": "password",
  "password": "pass",
  "username": "user@domain.com"
}'
Response 200 OK
{
  "access_token": "<TOKEN>",
  "expires_in": null,
  "refresh_token": null,
  "scope": null,
  "token_type": "bearer"
}

Create user token (code)

POST /oauth/token
Parameters
Name Type Required
code string
grant_type string
provider string
redirect_uri string
Request
curl -X POST "https://api.wedeploy.com/oauth/token?code=CODE&provider=github&redirect_uri=http://myproject.com" \
     -H "Content-Type: application/json" \
     -d $'{
  "code": "<CODE>",
  "grant_type": "authorization_code",
  "provider": "github"
}'
Response 200 OK
{
  "access_token": "<TOKEN>",
  "expires_in": null,
  "refresh_token": null,
  "scope": null,
  "token_type": "bearer"
}

Validators

Validate custom domains

GET /validators/projects/:projectId/services/:serviceId/custom-domains
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/projects/1/services/2/custom-domains?value=valid.wedeploy.com" -u user@domain.com:pass
Response 200 OK
(empty)

Validate email

GET /validators/email
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/email?value=email@domain.com" -u user@domain.com:pass
Response 200 OK
(empty)

Validate project collaborator

GET /validators/projects/:projectId/collaborator
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/projects/1/collaborator?value=1" -u user@domain.com:pass
Response 200 OK
(empty)

Validate account email

GET /validators/accounts/email
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/accounts/email?value=test@domain.com" -u user@domain.com:pass
Response 200 OK
(empty)

Validate project id

GET /validators/projects/id
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/projects/id?value=projectId" -u user@domain.com:pass
Response 200 OK
(empty)

Validate service id

GET /validators/projects/:projectId/services/id
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/projects/1/services/id?value=serviceId" -u user@domain.com:pass
Response 200 OK
(empty)

Validate required value

GET /validators/required
Parameters
Name Type Required
value string
Request
curl "https://api.wedeploy.com/validators/required?value=value"
Response 200 OK
(empty)

Hooks

Git Repository

POST /hooks/providers/:provider/build/:projectId/:masterToken?
Parameters
Name Type Required
ref string
repository string
Request
curl -X POST "https://api.wedeploy.com/hooks/providers/github/build/myproject/<OPTIONAL_PROJECT_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u user@domain.com:pass \
     -d $'{
  "ref": "refs/heads/master",
  "repository": {full_name: 'user/repo'},
}'
Response 200 OK
[
  {
    "cpu": 1.0,
    "createdAt": 1490054338701,
    "deployGroupUid": "<DEPLOY_GROUP_ID>",
    "health": "up",
    "id": "<UID>",
    "image": "wedeploy/hosting",
    "memory": 4096,
    "port": 80,
    "projectId": "myproject",
    "scale": 1,
    "serviceId": "hosting"
  },
  ...
]

Link Provider

GET /hooks/providers/:provider/oauth/link-provider
Parameters
Name Type Required
state string
code string
redirect_uri string
Request
curl "https://api.wedeploy.com/hooks/providers/Github/oauth/link-provider \
  ?state=<OAUTH_STATE> \
  &code=<OAUTH_CODE> \
  &redirect_uri=https://console.wedeploy.com/projects/:projectId/github"
Response 200 OK
(empty)

Realtime

Subscribe project activities

WS /subscribe/project/activities
Parameters
Name Type Required
accessToken string
projectId string

Subscribe user projects

WS /subscribe/user/projects
Parameters
Name Type Required
accessToken string

Subscribe project services

WS /subscribe/project/services
Parameters
Name Type Required
accessToken string
projectId string

Subscribe project service

WS /subscribe/project/service
Parameters
Name Type Required
accessToken string
projectId string
serviceId string

Metrics

Retrieve CPU metrics for service

Parameters
Name Type Required
period string
start string
end string
frequency string
order string
limit number
Request
curl "https://api.wedeploy.com/projects/myproject/services/myservice/metrics/cpu?period=10m&frequency=30s" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    time: 1504025885000,
    value: 0.0391573682,
    instance: 1
  },
  ...
]

Retrieve Memory metrics for service

Parameters
Name Type Required
period string
start string
end string
frequency string
order string
limit number
Request
curl "https://api.wedeploy.com/projects/myproject/services/myservice/metrics/memory?period=10m&frequency=30s" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    time: 1504025885000,
    value: 14401536,
    instance: 1
  },
  ...
]

Retrieve Traffic-In metrics for service

Parameters
Name Type Required
period string
start string
end string
frequency string
order string
limit number
Request
curl "https://api.wedeploy.com/projects/myproject/services/myservice/metrics/traffic/in?period=10m&frequency=30s" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    time: 1504025885000,
    value: 143,
    instance: 1
  },
  ...
]

Retrieve Traffic-Out metrics for service

Parameters
Name Type Required
period string
start string
end string
frequency string
order string
limit number
Request
curl "https://api.wedeploy.com/projects/myproject/services/myservice/metrics/traffic/out?period=10m&frequency=30s" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    time: 1504025885000,
    value: 143,
    instance: 1
  },
  ...
]

Retrieve Health metrics for service

Parameters
Name Type Required
period string
start string
end string
frequency string
order string
limit number
now boolean
Request
curl "https://api.wedeploy.com/projects/myproject/services/myservice/metrics/health?period=10m&frequency=30s" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    time: 1504025885000,
    value: 1,
    instance: 1
  },
  ...
]

Retrieve volume metrics for project

Request
curl "https://api.wedeploy.com/projects/myproject/metrics/volumes" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    "name": "283438694262688104-data",
    "path": "/var/lib/mysql",
    "files": 694,
    "directories": 5,
    "value": 134.155
  },
  ...
]

Usage

Retrieve account collaborator usage

GET /account/usage/collaborators
Request
curl "https://api.wedeploy.com/account/usage/collaborators" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 1,
  planTotal: 5,
  projects: [
    {
      projectId: "example",
      value: 1
    }
  ]
}

Retrieve account CPU usage

GET /account/usage/cpu
Request
curl "https://api.wedeploy.com/account/usage/cpu" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 0.5,
  planTotal: 1,
  services: [
    {
      projectId: "example",
      serviceId: "hosting",
      value: 0.5,
    }
  ]
}

Retrieve account custom domain usage

GET /account/usage/custom-domains
Request
curl "https://api.wedeploy.com/account/usage/custom-domains" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 1,
  planTotal: 5,
  services: [
    {
      serviceId: "hosting",
      projectId: "example",
      value: 1,
    }
  ]
}

Retrieve account instance usage

GET /account/usage/instances
Request
curl "https://api.wedeploy.com/account/usage/instances" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 1,
  planTotal: 2,
  services: [
    {
      serviceId: "hosting",
      projectId: "example",
      value: 1,
    }
  ]
}

Retrieve account memory usage

GET /account/usage/memory
Request
curl "https://api.wedeploy.com/account/usage/memory" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 512,
  planTotal: 1024,
  services: [
    {
      serviceId: "hosting",
      projectId: "example",
      value: 512,
    }
  ]
}

Retrieve account projects usage

GET /account/usage/projects
Request
curl "https://api.wedeploy.com/account/usage/projects" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 1,
  planTotal: 3,
}

Retrieve account support capability

GET /account/usage/support
Request
curl "https://api.wedeploy.com/account/usage/support" \
  -u user@domain.com:pass
Response 200 OK
{
  value: false,
}

Retrieve account scale capability

GET /account/usage/scale
Request
curl "https://api.wedeploy.com/account/usage/scale" \
  -u user@domain.com:pass
Response 200 OK
{
  value: true,
}

Retrieve account traffic usage

GET /account/usage/traffic
Request
curl "https://api.wedeploy.com/account/usage/traffic" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 4341653,
  planTotal: 1024000000,
  services: [
    {
      serviceId: "hosting",
      projectId: "example",
      value: 4341653,
    }
  ]
}

Retrieve account volume usage

GET /account/usage/volumes
Request
curl "https://api.wedeploy.com/account/usage/volumes" \
  -u user@domain.com:pass
Response 200 OK
{
  "value": 274240995,
  "planTotal": 1000,
  "services": [
    {
      "name": "283438694262688104-data",
      "path": "/var/lib/mysql",
      "files": 694,
      "directories": 5,
      "value": 274240995
    }
  ]
}

Retrieve all usages

GET /account/usage
Request
curl "https://api.wedeploy.com/account/usage" \
  -u user@domain.com:pass
Response 200 OK
{
  "collaborators": {
    "value": 0,
    "planTotal": 600,
    "projects": [
      {
        "projectId": "test1",
        "value": 0
      }
    ]
  },
  "cpu": {
    "value": 6,
    "planTotal": 300,
    "services": [
      {
        "projectId": "test1",
        "serviceId": "db",
        "value": 6
      }
    ]
  },
  "customDomains": {
    "value": 0,
    "planTotal": 600,
    "services": [
      {
        "projectId": "test1",
        "serviceId": "db",
        "value": 0
      }
    ]
  },
  "memory": {
    "value": 4096,
    "planTotal": 307200,
    "services": [
      {
        "projectId": "test1",
        "serviceId": "db",
        "value": 4096
      }
    ]
  },
  "projects": {
    "value": 1,
    "planTotal": 300
  },
  "instances": {
    "value": 1,
    "planTotal": 300,
    "services": [
      {
        "projectId": "test1",
        "serviceId": "db",
        "value": 1
      }
    ]
  },
  "traffic": {
    "value": 35785407.70634852,
    "planTotal": 10737418240000,
    "services": [
      {
        "projectId": "test1",
        "serviceId": "db",
        "value": 35785407.70634852
      }
    ]
  },
  "volumes": {
    "value": 274240995,
    "planTotal": 1000,
    "services": [
      {
        "name": "276399336844630531-data",
        "path": "/var/lib/mysql",
        "files": 694,
        "directories": 5,
        "value": 274240995
      }
    ]
  }
}

Retrieve top usage

GET /account/usage/top
Request
curl "https://api.wedeploy.com/account/usage/top" \
  -u user@domain.com:pass
Response 200 OK
{
  value: 0.6666666666666666,
  planTotal: 1,
  services: [
    {
      projectId: "example",
      serviceId: "hosting",
      value: 0.3333333333333333
    },
    {
      projectId: "example",
      serviceId: "auth",
      value: 0.3333333333333333
    },
  ]
}

Billing

List current account subscription

GET /account/billing/subscriptions
Request
curl "https://api.wedeploy.com/account/billing/subscriptions" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    id: "sub_BRD6hMr5X9rPGS",
    planId: "free",
    status: "active",
    amount: 0,
    currency: "usd",
    interval: "month",
    intervalCount: 1,
    createdAt: 1505961871000,
    canceledAt: null,
    endedAt: null,
    currentPeriodEnd: 1508553871000,
    currentPeriodStart: 1505961871000,
    trialEnd: null,
    trialStart: null
  }
]

List invoices for account

GET /account/billing/invoices
Request
curl "https://api.wedeploy.com/account/billing/invoices" \
  -u user@domain.com:pass
Response 200 OK
[
  {
    id: "in_1B4KfzErwzAsisk6abS3yUuJ",
    date: 1505961871000,
    lines: [
      {
        planId: "free",
        description: "WeDeploy Free",
        subtotal: 0,
        total: 0,
        amountDue: 0,
        currency: "usd",
        interval: "month",
        intervalCount: 1,
        trial: null,
        periodEnd: 1508553871000,
        periodStart: 1505961871000
      }
    ]
  }
  ...
]

Retrieve payment info for account

GET /account/billing/payment-info
Request
curl "https://api.wedeploy.com/account/billing/payment-info" \
  -u user@domain.com:pass
Response 200 OK
{
  brand: "Visa",
  last4: "4242",
  token: "tok_1B4KrxErwzAsisk6QCiNsdt2",
  type: "card"
}

Retrieve trial period for plan

GET /account/billing/trial-period/:planId
Request
curl "https://api.wedeploy.com/account/billing/trial-period/:planId" \
  -u user@domain.com:pass
Response 200 OK
{
  trialPeriod: 7
}

Update payment info for account

POST /account/billing/payment-info
Parameters
Name Type Required
stripeToken string
stripeTokenType string
shippingName string
shippingAddressCountry string
shippingAddressCountryCode string
shippingAddressZip string
shippingAddressLine1 string
shippingAddressCity string
shippingAddressStat string
Request
curl -X POST "https://api.wedeploy.com/account/billing/payment-info" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -u user@domain.com:pass \
  -d $'{
  "stripeToken": "tok_1B4L0ZErwzAsisk6GKGA4FHj",
  "stripeTokenType": "card"
  "shippingName": "Liferay",
  "shippingAddressCountry": "United States",
  "shippingAddressCountryCode": "US",
  "shippingAddressZip": "91765",
  "shippingAddressLine1": "1400 Montefino Ave",
  "shippingAddressCity": "Diamond Bar",
  "shippingAddressState": "91765",
}'
Response 200 OK
{
  customerPaymentType: "card",
  customerPaymentToken: "tok_1B4L0ZErwzAsisk6GKGA4FHj",
}

Subscribe to plan

POST /account/billing/subscribe
Parameters
Name Type Required
planId string
coupon string
Request
curl -X POST "https://api.wedeploy.com/account/billing/subscribe" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -u user@domain.com:pass \
  -d $'{
  "planId": "basic",
  "coupon": "DEVCON2017"
}'
Response 200 OK
{
  "subscriptionId": "sub_BRDbydjqmxaAdw"
}

Unsubscribe from plan

POST /account/billing/unsubscribe
Name Type Required
planId string
Request
curl -X POST "https://api.wedeploy.com/account/billing/unsubscribe" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -u user@domain.com:pass \
  -d $'{
  "planId": "basic"
}'
Response 200 OK
(empty)

Vpn

Connect to a vpn service

POST /projects/:projectId/vpn
Request
curl -X POST "https://api.wedeploy.com/projects/:projectId/vpn" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
            "host": "127.0.0.1:8090",
            "login": "the-login",
            "password": "the-password",
            "certificate": "-----BEGIN CERTIFICATE-----\nMIIDFzCCAf+gAwIBDQEBCwUAMBExDzANBgNV\n-----END CERTIFICATE-----"
     }'
Response 200 OK
{
  connected: true,
  host: "127.0.0.1:8090",
  login: "the-login",
  password: "the-password",
  certificate: "-----BEGIN CERTIFICATE-----\nMIIDFzCCAf+gAwIBDQEBCwUAMBExDzANBgNV\n-----END CERTIFICATE-----"
}

Disconnect vpn service

DELETE /projects/:projectId/vpn
Request
curl -X DELETE "https://api.wedeploy.com/projects/:projectId/vpn" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
Response 200 OK
{
 connected: false
}

Return vpn connection configurations

GET /projects/:projectId/vpn
Request
curl "https://api.wedeploy.com/projects/:projectId/vpn" -u teamuser@domain.com:pass
Response 200 OK
{
  connected: true,
  host: "127.0.0.1:8090",
  password: "123456",
  login: "the-login",
  certificate: "-----BEGIN CERTIFICATE-----\nMIIDFzCCAf+gAwIBDQEBCwUAMBExDzANBgNV\n-----END CERTIFICATE-----",
  forwardingPorts: [],
}

Maintenance vpn port forwarding

POST /projects/:projectId/vpn-forwarding
Request
curl -X POST "https://api.wedeploy.com/projects/:projectId/vpn-forwarding" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
       "forwarding":
        [
          {
            "host": "127.0.0.1",
            "port": 8090,
          },
          {
            "host": "127.0.0.1",
            "port": 8091,
          }
        ]
      }'
Response 200 OK
{
  connected: true,
  host: "127.0.0.1:8090",
  password: "123456",
  login: "the-login",
  certificate: "-----BEGIN CERTIFICATE-----\nMIIDFzCCAf+gAwIBDQEBCwUAMBExDzANBgNV\n-----END CERTIFICATE-----",
  forwardingPorts: [
    {
      host: "127.0.0.1",
      port: 8090,
      internalPort: 30125
    },
    {
      host: "127.0.0.1",
      port: 8091,
      internalPort: 30126
    }
  ]
}

Admin

List All of Collection

GET /admin/:collection/:id?

Examples:

GET /admin/activities/:id?
GET /admin/builds/:id?
GET /admin/envs/:id?
GET /admin/plans/:id?
GET /admin/projects/:id?
GET /admin/services/:id?
GET /admin/users/:id?
Parameters
Name Type Required Options
type string count
limit string
offset string
field string
order string asc, desc
Request
curl "https://api.wedeploy.com/admin/users?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" -u teamuser@domain.com:pass
Response 200 OK
[
  {
    "createdAt": 1489019572853,
    "email": "user@domain.com",
    "id": "<UID>",
    "initials": "E",
    "invitationPending": false,
    "name": "User Name"
  },
  ...
]

if type=count

{
  "count": 100,
}

List Health of all Services

GET /admin/health
Request
curl "https://api.wedeploy.com/admin/health?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" -u teamuser@domain.com:pass
Response 200 OK
[
  {
    node: {
      total: 1,
      up: 1
    },
    miscellaneous: {
      total: 0,
      up: 0
    },
    wedeploy/auth: {
      total: 1,
      up: 0
    },
    wedeploy/data: {
      total: 1,
      up: 0
    },
    wedeploy/email: {
      total: 0,
      up: 0
    },
    wedeploy/engine: {
      total: 0,
      up: 0
    },
    wedeploy/hosting: {
      total: 2,
      up: 2
    },
    wedeploy/liferay: {
      total: 0,
      up: 0
    }
  }
  ...
]

Retrieve system wide usage

GET /admin/usage
Request
curl "https://api.wedeploy.com/admin/usage?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" -u teamuser@domain.com:pass
Response 200 OK
{
  "cpu": 123,
  "memory": 204800,
  "customDomains": 100,
  "instances": 200,
  "collaborators": 25,
  "traffic": 231829384731,
  "storage": 102400005678,
}

Update Collection Document

PATCH /admin/:collection/:id?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>
Request
curl -X PATCH "https://api.wedeploy.com/admin/users/123?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
        "email":"update@domain.com",
        "name":"Updated Name",
        "supportedScopes": ["team"]
     }'
Response 200 OK
(empty)

Post Collection Document

POST /admin/:collection?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>
Request
curl -X POST "https://api.wedeploy.com/admin/projects?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
        "projectId": "myproject",
        "id": "5678",
        "collaborators": ["212069869435631201"]
     }'
Response 200 OK
{
  "collaborators": [
    "212069869435631201"
  ],
  "id": "5678",
  "projectId": "myproject",
}

Delete user

DELETE /admin/user/:userId?
Parameters
Name Type Required
email string
id string
Request
curl -X DELETE "https://api.wedeploy.com/admin/user/123?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -u teamuser@domain.com:pass
Response 204 No Content
(empty)

Delete collection

DELETE /admin/collection/:collection/:id/:field?

####DO NOT USE UNLESS YOU JUST NEED TO DELETE A DOCUMENT AND NOT THEIR RELATED ASSETS

FOR EXAMPLE, THIS WILL NOT DELETE THE SERVICES OF A PROJECT
Request
curl -X DELETE "https://api.wedeploy.com/admin/projects/123/ownerId?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -u teamuser@domain.com:pass
Response 200 OK
(empty)

Subscribe user to plan

POST /admin/billing/subscribe/user/:userId
Request
curl -X POST "https://api.wedeploy.com/admin/billing/subscribe/user/123?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass \
     -d '{
        "planId": "premium"
     }'
Response 200 OK
{
  "subscriptionId": "sub_BRDbydjqmxaAdw"
}

Retrieve user account usage by spec

GET /admin/usage/:spec/user/:userId
Request
curl -X GET "https://api.wedeploy.com/admin/usage/cpu/user/123?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass
Response 200 OK
{
  value: 0.5,
  planTotal: 1,
  services: [
    {
      projectId: "example",
      serviceId: "hosting",
      value: 0.5,
    }
  ]
}

Recover WeDeploy

POST /admin/wedeploy/recover
Request
curl -X POST "https://api.wedeploy.com/admin/wedeploy/recover?master_token=<OPTIONAL_WEDEPLOY_MASTER_TOKEN>" \
     -H "Content-Type: application/json" \
     -u teamuser@domain.com:pass
Response 204 No Content
(empty)

CI Pipeline

There is a Jenkinsfile containing the information about how this project is built. There, we select a Jenkins slave node to execute the tasks, and then we define several stages for the pipeline:

  • Setup: we asure the machine has been configured properly, mainly node.
  • Install dependencies: we fetch all dependencies using NPM.
  • Start infrastructure: we start the local infrastructure
  • Test: we execute unit and integration tests in parallel against the XYZ environment. At the end of the test execution, the CI server will gather the test execution results.

Finally, when all previous stages have finished, we ensure that the infrastructure is shutdown properly.

Building the image

The build of the image has been delegated to the CI. A merge commit to master will update the current snapshot, following tag name convention:

Successfully tagged wedeploy/api:staging
Successfully tagged wedeploy/api:local
Successfully tagged wedeploy/api:4.5.2-20190329084603_942b49f4
Successfully tagged wedeploy/api:4.5.2

Tagging docker image

The wedeploy/api:local image can be tagged by running the ./tag-images.sh script. With it you can customize some parameters of the build:

variable description
IMAGE_PREFIX Configures the prefix of the image (defaults to wedeploy)
IMAGE_TAG Configures the tag of the image (defaults to staging)

For instance:

IMAGE_PREFIX=localhost:5000/cirocosta.co \
  IMAGE_TAG=dev \
  ./tag-images.sh


# Starting to tag image

#   FULL_NAME:              localhost:5000/cirocosta.co/api:dev
#   IMAGE_PREFIX:           localhost:5000/cirocosta.co
#   IMAGE_TAG:              dev
#   CONTEXT:                /Users/cirocosta/Development/wedeploy/api

Note 1.: In order to tag the docker images, it assumes you have previously built the current code with the tag local.

Publishing the image to Docker Hub

We advise against pushing local images in favour of letting the CI to do it. For that reason the push script has been removed from this repository. Instead, the CI will push the image in two scenarios:

  1. On merges to master: it will push a Docker tag following this tag name convention currentVersion-timestamp_shortHash. As an example: 4.5.2-20190227111212_abcdef.
  2. On git tags (api releases): it will push a Docker tag with the current version. The latest tag won't be updated. It's important to mention that the git tag value must go in-sync with project version.

If you are still interested in pushing from local, which is not a best practice, please follow Jenkinsfile instructions to build and push the image.

There is a ./package.json file with current version of the image. This value determines the tag of the Docker image representing the project. Please do not update it manually: use the available scripts instead.

Automated publish

Send a pull request to wedeploy/api Github repository, against master branch. At release time, a merge commit to master branch will produce that the CI server (Jenkins) pushes the Docker image with following tags:

wedeploy/api:staging
wedeploy/api:4.5.2-20190329084603_942b49f4

Manual release

If you still want to build, push and release the api images locally, please use the commands that are present in the Jenkinsfile, where you can clearly see which environment variables are affecting the build.

This is not recommended, as the publication of the image must be as much automated as possible, using the CI. First make sure that your "local" tag is in the desired state.
# Download release scripts
GITHUB_TOKEN='YOUR_GITHUB_TOKEN' ./.jenkins/main.sh --setup-machine
# Build images with proper tag convention
./.jenkins/main.sh --build-images
# Push snapshots to Docker Hub
DOCKER_USERNAME='YOUR_DOCKER_USER' DOCKER_PASSWORD='YOUR_DOCKER_PASSWORD' ./.jenkins/main.sh --push-images
# Push release to Docker Hub
DOCKER_USERNAME='YOUR_DOCKER_USER' DOCKER_PASSWORD='YOUR_DOCKER_PASSWORD' ./.jenkins/main.sh --release-images

Releasing the image

To release the api images using SEMVER, we are going to use mdelapenya/webump:1.0.0. Just execute the following shell script to perform the bump:

./bump.sh [major|minor|patch]

which will update the version present in the package.json in consequence. This will also create a git commit with the bump, and a git tag with the proper version. After pushing this git tag to the repository, the CI will execute the release process, which will read the current value of the version from the previous files, and use them as Docker tag. Then it will push the released image to Docker Hub, using the described above process for releasing.

IMPORTANT: You still have to go to Jenkins UI to manually trigger the build. Check out why here.

License

BSD-3-Clause © Liferay, Inc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment