v1
Double column
API
CLI
JS Client

Services /

Update service ports

Updates the list of ports for the given service.

Required permission

Project > Services > General > Update

Path parameters

    • projectId

      string required

      ID of the project

    • serviceId

      string required

      ID of the service

Request body

  • {object}
    • ports

      [array] required

      An array of ports to replace or update existing ports with.

      • {object}
        • id

          string

          The id of an existing port. Pass this when changing in order to keep security configurations.

          pattern
          ^[a-z]-?[a-z0-9]+(-[a-z0-9]+)*$
        • name

          string required

          The name used to identify the port.

          min length
          1
          max length
          8
          pattern
          ^[a-zA-Z](-?[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$
        • internalPort

          integer required

          The port number.

          min
          1
          max
          65535
        • public

          boolean

          If true, the port will be exposed publicly.

        • protocol

          string required

          The protocol to use for the port. Public ports only support HTTP.

          one of
          HTTP, TCP, UDP
        • domains

          [array]

          An array of domains to redirect to this port. Each domain must first be verified and registered to your account.

          • string

            A domain to redirect to this port.

        • security

          {object}
          • credentials

            [array]

            An array of credentials to access the service.

            • {object}
              • username

                string required

                The username to access the service

                min length
                3
                max length
                20
                pattern
                ^[a-zA-Z0-9]+$
              • password

                string required

                The password to access the service with this username.

              • type

                string required

                The type of authentication used

                one of
                basic-auth
          • policies

            [array]

            An array of IP address policies.

            • {object}
              • addresses

                [array] required

                An array of IP addresses used for this rule

                • string

                  An IP address used by this rule

              • action

                string required

                The action for this rule.

                one of
                ALLOW, DENY

Response body

  • {object}

    Response object.

    • data

      {object} required

      Result data.

    API
    CLI
    JS Client

    POST /v1/projects/{projectId}/services/{serviceId}/ports

    Example request

    Request body

    curl
    curl --header "Content-Type: application/json" \
      --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
      --request POST \
      --data '{"ports":[{"id":"eonyui","name":"port-1","internalPort":12345,"public":true,"protocol":"HTTP","domains":["app.example.com"],"security":{"credentials":[{"username":"admin","password":"password123","type":"basic-auth"}],"policies":[{"addresses":["127.0.0.1"],"action":"DENY"}]}}]}' \
      https://api.northflank.com/v1/projects/{projectId}/services/{serviceId}/ports

    Example response

    200 OK

    The operation was performed successfully.

    JSON

    {
      "data": {}
    }

    Example response

    404 Not Found

    One of the provided domains has not been registered to this account.

    © 2021 Northflank Ltd. All rights reserved.