AS2 Stations

An AS2Station is a remote AS2 server that can send data into Files.com and receive data from Files.com.

List AS2 Stations

SDK Method

as2station.List()

Return Object

[]*As2Station

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    as2_station "github.com/Files-com/files-sdk-go/v3/as2station"
)

as2StationIterator, err := as2_station.List(files_sdk.As2StationListParams{})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

for as2StationIterator.Next() {
    as2Station := as2StationIterator.as2Station()
}
err = as2StationIterator.Err()
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Show AS2 Station

SDK Method

as2station.Find()

Return Object

As2Station

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

As2StationFindParams Fields

FieldDescription
Id
int64
Required
As2 Station ID.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    as2_station "github.com/Files-com/files-sdk-go/v3/as2station"
)

as2Station, err := as2_station.Find(files_sdk.As2StationFindParams{Id: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Create AS2 Station

SDK Method

as2station.Create()

Return Object

As2Station

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

As2StationCreateParams Fields

FieldDefaultDescription
Name
string
Required
The station's formal AS2 name.
WorkspaceId
int64
0ID of the Workspace associated with this AS2 Station.
PublicCertificate
string
Required
PrivateKey
string
Required
PrivateKeyPassword
string

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    as2_station "github.com/Files-com/files-sdk-go/v3/as2station"
)

as2Station, err := as2_station.Create(files_sdk.As2StationCreateParams{
  Name: "AS2 Station Name",
  PublicCertificate: "public_certificate",
  PrivateKey: "private_key"
})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Update AS2 Station

SDK Method

as2station.Update()

Return Object

As2Station

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

As2StationUpdateParams Fields

FieldDescription
Id
int64
Required
As2 Station ID.
Name
string
The station's formal AS2 name.
PublicCertificate
string
PrivateKey
string
PrivateKeyPassword
string

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    as2_station "github.com/Files-com/files-sdk-go/v3/as2station"
)

as2Station, err := as2_station.Update(files_sdk.As2StationUpdateParams{
  Id: 1,
  Name: "AS2 Station Name"
})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Delete AS2 Station

SDK Method

as2station.Delete()

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

As2StationDeleteParams Fields

FieldDescription
Id
int64
Required
As2 Station ID.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    as2_station "github.com/Files-com/files-sdk-go/v3/as2station"
)

err := as2_station.Delete(files_sdk.As2StationDeleteParams{Id: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

The As2Station Object

Some of the methods above return a As2Station object. The attributes of this object are listed below.

AttributeDescription
Id
int64
Id of the AS2 Station.
WorkspaceId
int64
ID of the Workspace associated with this AS2 Station.
Name
string
The station's formal AS2 name.
Uri
string
Public URI for sending AS2 message to.
Domain
string
The station's AS2 domain name.
HexPublicCertificateSerial
string
Serial of public certificate used for message security in hex format.
PublicCertificateMd5
string
MD5 hash of public certificate used for message security.
PublicCertificate
string
Public certificate used for message security.
PrivateKeyMd5
string
MD5 hash of private key used for message security.
PublicCertificateSubject
string
Subject of public certificate used for message security.
PublicCertificateIssuer
string
Issuer of public certificate used for message security.
PublicCertificateSerial
string
Serial of public certificate used for message security.
PublicCertificateNotBefore
string
Not before value of public certificate used for message security.
PublicCertificateNotAfter
string
Not after value of public certificate used for message security.
PrivateKeyPasswordMd5
string
MD5 hash of private key password used for message security.