Ana içeriğe atla

General Information

Connection Type

linux-script

UI Documentation

Endpoints

List Connections

GET /apiops/projects/{projectName}/connections/?type=linux-script

Get Connection

GET /apiops/projects/{projectName}/connections/{connectionName}/

Create Connection

POST /apiops/projects/{projectName}/connections/{connectionName}/

Update Connection

PUT /apiops/projects/{projectName}/connections/{connectionName}/

Delete Connection

DELETE /apiops/projects/{projectName}/connections/{connectionName}/

List Connections

Endpoint

GET /apiops/projects/{projectName}/connections/?type=linux-script

Request

Headers

HeaderValue
AuthorizationBearer

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
Note: The type query parameter is required to filter connections by type.

cURL Example

curl -X GET \
  "https://demo.apinizer.com/apiops/projects/MyProject/connections/" \
  -H "Authorization: Bearer YOUR_TOKEN"

Get Connection

Endpoint

GET /apiops/projects/{projectName}/connections/{connectionName}/

Request

Headers

HeaderValue
AuthorizationBearer

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name

Response

Success Response (200 OK)

{
  "success": true,
  "resultList": [
    {
      "type": "linux-script",
      "name": "my-linux-script-connection",
      "description": "Linux script connection via SSH",
      "deployToWorker": true,
      "enabled": true,
      "hostName": "linux.example.com",
      "sshPort": 22,
      "username": "apinizer",
      "password": null
    }
  ],
  "resultCount": 1
}
Note: Password is masked in get operations.

cURL Example

curl -X GET \
  "https://demo.apinizer.com/apiops/projects/MyProject/connections/my-linux-script-connection/" \
  -H "Authorization: Bearer YOUR_TOKEN"

Create Connection

Endpoint

POST /apiops/projects/{projectName}/connections/{connectionName}/

Request

Headers

HeaderValue
AuthorizationBearer
Content-Typeapplication/json

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name

Request Body

Full JSON Body Example - Basic SSH Connection
{
  "type": "linux-script",
  "name": "my-linux-script-connection",
  "description": "Linux script connection via SSH",
  "deployToWorker": true,
  "enabled": true,
  "hostName": "linux.example.com",
  "sshPort": 22,
  "username": "apinizer",
  "password": "password123"
}
Full JSON Body Example - Custom SSH Port
{
  "type": "linux-script",
  "name": "my-linux-script-custom-port",
  "description": "Linux script connection with custom SSH port",
  "deployToWorker": true,
  "enabled": true,
  "hostName": "linux.example.com",
  "sshPort": 2222,
  "username": "apinizer",
  "password": "password123"
}
Request Body Fields
Common Fields
FieldTypeRequiredDefaultDescription
typestringYes-Connection type discriminator field. Identifies the connection type in API requests/responses.
namestringYes-Connection name (must match path parameter)
descriptionstringNo-Connection description
deployToWorkerbooleanNotrueWhether to deploy to worker
enabledbooleanNotrueWhether connection is enabled
Linux Script-Specific Fields
FieldTypeRequiredDefaultDescription
hostNamestringYes-Linux server hostname or IP address
sshPortintegerNo22SSH port number (default: 22)
usernamestringYes-SSH username
passwordstringYes-SSH password (secret field)

Notes

  • hostName, username, and password are required.
  • sshPort defaults to 22 (standard SSH port).
  • Connection uses SSH protocol for secure remote script execution.
  • Password is stored securely and masked in responses.

Response

Success Response (200 OK)

{
  "success": true,
  "deploymentResult": {
    "success": true,
    "deploymentResults": [
      {
        "environmentName": "production",
        "success": true,
        "message": "Deployment successful"
      }
    ]
  }
}

cURL Example

curl -X POST \
  "https://demo.apinizer.com/apiops/projects/MyProject/connections/my-linux-script-connection/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "linux-script",
    "name": "my-linux-script-connection",
    "description": "Linux script connection via SSH",
    "deployToWorker": true,
    "enabled": true,
    "hostName": "linux.example.com",
    "sshPort": 22,
    "username": "apinizer",
    "password": "password123"
  }'

Update Connection

Endpoint

PUT /apiops/projects/{projectName}/connections/{connectionName}/

Request

Headers

HeaderValue
AuthorizationBearer
Content-Typeapplication/json

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name (must match name in body)

Request Body

Full JSON Body Example
{
  "type": "linux-script",
  "name": "my-linux-script-connection",
  "description": "Updated Linux script connection via SSH",
  "deployToWorker": true,
  "enabled": true,
  "hostName": "new-linux.example.com",
  "sshPort": 2222,
  "username": "newuser",
  "password": "newpassword456"
}
Note: Request body structure is the same as Create Connection. All fields should be provided for update.

Response

Success Response (200 OK)

{
  "success": true,
  "deploymentResult": {
    "success": true,
    "deploymentResults": [...]
  }
}

Delete Connection

Endpoint

DELETE /apiops/projects/{projectName}/connections/{connectionName}/

Request

Headers

HeaderValue
AuthorizationBearer

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name

Response

Success Response (200 OK)

{
  "success": true,
  "deploymentResult": {
    "success": true,
    "deploymentResults": [...]
  }
}

Notes and Warnings

  • SSH Protocol:
    • Connection uses SSH (Secure Shell) protocol for secure remote access
    • Standard SSH port is 22
    • Supports password-based authentication
  • Hostname:
    • hostName can be a hostname or IP address
    • Ensure hostname resolves correctly or use IP address
  • Port:
    • sshPort defaults to 22 (standard SSH port)
    • Use custom port if SSH server is configured on non-standard port
  • Authentication:
    • username and password are required
    • Password is stored securely and masked in responses
    • Consider using SSH key-based authentication (if supported)
  • Security:
    • Use strong passwords
    • Ensure SSH server is properly secured
    • Consider using non-standard ports for additional security
    • Use firewall rules to restrict SSH access
  • Script Execution:
    • Scripts are executed on the remote Linux server
    • Ensure user has necessary permissions to execute scripts
    • Scripts run with the privileges of the specified user
  • Network:
    • Ensure network connectivity between Apinizer worker and Linux server
    • Firewall rules must allow SSH connections
    • Consider VPN or private network for production
  • Performance:
    • SSH connections have overhead
    • Script execution time depends on script complexity and server performance
    • Consider timeout settings for long-running scripts
  • Deployment: Connection changes require deployment to take effect. Set deployToWorker: true or deploy manually.