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

as2_station.List()

Return Values

Returns a *as2_station.Iter and an error. Range over All() to receive files_sdk.As2Station values and errors. Check each loop error before using its resource. Next() and Err() remain supported.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

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.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}

for as2Station, err := range as2StationIterator.All() {
    if err != nil {
        var respErr files_sdk.ResponseError
        if errors.As(err, &respErr) {
            fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
        } else {
            fmt.Printf("Request failed: %v\n", err)
        }
        return
    }
    fmt.Println(as2Station)
}

Show AS2 Station

SDK Method

as2_station.Find()

Return Values

Returns a files_sdk.As2Station value and an error.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

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.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}
fmt.Println(as2Station)

Create AS2 Station

SDK Method

as2_station.Create()

Return Values

Returns a files_sdk.As2Station value and an error.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

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
Public certificate used for message security.
PrivateKey
string
PEM-encoded private key matching public_certificate.
PrivateKeyPassword
string
Password for the PEM-encoded private key.
Pkcs12
string
Base64-encoded PKCS#12 (.pfx or .p12) file containing the identity's certificate and private key. Provide this instead of public_certificate and private_key.
Pkcs12Password
string
Password for pkcs12. The file and password are used only for import; the extracted certificate and private key are stored as PEM.

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"})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}
fmt.Println(as2Station)

Update AS2 Station

SDK Method

as2_station.Update()

Return Values

Returns a files_sdk.As2Station value and an error.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

As2StationUpdateParams Fields

FieldDescription
Id
int64
Required
As2 Station ID.
Name
string
The station's formal AS2 name.
PublicCertificate
string
Public certificate used for message security.
PrivateKey
string
PEM-encoded private key matching public_certificate.
PrivateKeyPassword
string
Password for the PEM-encoded private key.
Pkcs12
string
Base64-encoded PKCS#12 (.pfx or .p12) file containing the identity's replacement certificate and private key. Provide this instead of public_certificate and private_key.
Pkcs12Password
string
Password for pkcs12. The file and password are used only for import; the extracted certificate and private key are stored as PEM.

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.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}
fmt.Println(as2Station)

Delete AS2 Station

SDK Method

as2_station.Delete()

Return Values

Returns an error, or nil on success.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

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.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}

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.