AS2 Partners

An AS2Partner is a counterparty of the Files.com site's AS2 connectivity. Generally you will have one AS2 Partner created for each counterparty with whom you send and/or receive files via AS2.

List AS2 Partners

SDK Method

as2partner.List()

Return Object

[]*As2Partner

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_partner "github.com/Files-com/files-sdk-go/v3/as2partner"
)

as2PartnerIterator, err := as2_partner.List(files_sdk.As2PartnerListParams{})
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 as2PartnerIterator.Next() {
    as2Partner := as2PartnerIterator.as2Partner()
}
err = as2PartnerIterator.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 Partner

SDK Method

as2partner.Find()

Return Object

As2Partner

Authorization Requirement

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

As2PartnerFindParams Fields

FieldDescription
Id
int64
Required
As2 Partner ID.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    as2_partner "github.com/Files-com/files-sdk-go/v3/as2partner"
)

as2Partner, err := as2_partner.Find(files_sdk.As2PartnerFindParams{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 Partner

SDK Method

as2partner.Create()

Return Object

As2Partner

Authorization Requirement

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

As2PartnerCreateParams Fields

FieldDefaultDescription
EnableDedicatedIps
boolean
falseIf true, we will use your site's dedicated IPs for all outbound connections to this AS2 Partner.
HttpAuthUsername
string
Username to send to server for HTTP Authentication.
HttpAuthPassword
string
Password to send to server for HTTP Authentication.
MdnValidationLevel
string
"auto"How should Files.com evaluate message transfer success based on a partner's MDN response? This setting does not affect MDN storage; all MDNs received from a partner are always stored. none: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. weak: Inspect the MDN for MIC and Disposition only. normal: weak plus validate MDN signature matches body, strict: normal but do not allow signatures from self-signed or incorrectly purposed certificates. auto: Automatically set the correct value for this setting based on next mdn received.
Possible values: none, weak, normal, strict, auto
SignatureValidationLevel
string
"auto"Should Files.com require signatures on incoming AS2 messages? normal: require that incoming messages are signed with a valid matching signature. none: Unsigned incoming messages are allowed. auto: Automatically set the correct value for this setting based on next message received.
Possible values: normal, none, auto
ServerCertificate
string
"require_match"Should we require that the remote HTTP server have a valid SSL Certificate for HTTPS? (This only applies to Outgoing AS2 message from Files.com to a Partner.)
Possible values: require_match, allow_any
DefaultMimeType
string
Default mime type of the file attached to the encrypted message
AdditionalHttpHeaders
object
Additional HTTP Headers for outgoing message sent to this partner.
As2StationId
int64
Required
ID of the AS2 Station associated with this partner.
Name
string
Required
The partner's formal AS2 name.
Uri
string
Required
Public URI where we will send the AS2 messages (via HTTP/HTTPS).
PublicCertificate
string
Required
Public certificate for AS2 Partner. Note: This is the certificate for AS2 message security, not a certificate used for HTTPS authentication.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    as2_partner "github.com/Files-com/files-sdk-go/v3/as2partner"
)

as2Partner, err := as2_partner.Create(files_sdk.As2PartnerCreateParams{
  As2StationId: 1,
  Name: "AS2 Partner Name",
  Uri: "example",
  PublicCertificate: "public_certificate"
})
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 Partner

SDK Method

as2partner.Update()

Return Object

As2Partner

Authorization Requirement

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

As2PartnerUpdateParams Fields

FieldDescription
Id
int64
Required
As2 Partner ID.
EnableDedicatedIps
boolean
If true, we will use your site's dedicated IPs for all outbound connections to this AS2 Partner.
HttpAuthUsername
string
Username to send to server for HTTP Authentication.
HttpAuthPassword
string
Password to send to server for HTTP Authentication.
MdnValidationLevel
string
How should Files.com evaluate message transfer success based on a partner's MDN response? This setting does not affect MDN storage; all MDNs received from a partner are always stored. none: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. weak: Inspect the MDN for MIC and Disposition only. normal: weak plus validate MDN signature matches body, strict: normal but do not allow signatures from self-signed or incorrectly purposed certificates. auto: Automatically set the correct value for this setting based on next mdn received.
Possible values: none, weak, normal, strict, auto
SignatureValidationLevel
string
Should Files.com require signatures on incoming AS2 messages? normal: require that incoming messages are signed with a valid matching signature. none: Unsigned incoming messages are allowed. auto: Automatically set the correct value for this setting based on next message received.
Possible values: normal, none, auto
ServerCertificate
string
Should we require that the remote HTTP server have a valid SSL Certificate for HTTPS? (This only applies to Outgoing AS2 message from Files.com to a Partner.)
Possible values: require_match, allow_any
DefaultMimeType
string
Default mime type of the file attached to the encrypted message
AdditionalHttpHeaders
object
Additional HTTP Headers for outgoing message sent to this partner.
Name
string
The partner's formal AS2 name.
Uri
string
Public URI where we will send the AS2 messages (via HTTP/HTTPS).
PublicCertificate
string
Public certificate for AS2 Partner. Note: This is the certificate for AS2 message security, not a certificate used for HTTPS authentication.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    as2_partner "github.com/Files-com/files-sdk-go/v3/as2partner"
)

as2Partner, err := as2_partner.Update(files_sdk.As2PartnerUpdateParams{
  Id: 1,
  EnableDedicatedIps: lib.Bool(true)
})
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 Partner

SDK Method

as2partner.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.

As2PartnerDeleteParams Fields

FieldDescription
Id
int64
Required
As2 Partner ID.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    as2_partner "github.com/Files-com/files-sdk-go/v3/as2partner"
)

err := as2_partner.Delete(files_sdk.As2PartnerDeleteParams{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 As2Partner Object

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

AttributeDescription
Id
int64
ID of the AS2 Partner.
WorkspaceId
int64
ID of the Workspace associated with this AS2 Partner.
As2StationId
int64
ID of the AS2 Station associated with this partner.
Name
string
The partner's formal AS2 name.
Uri
string
Public URI where we will send the AS2 messages (via HTTP/HTTPS).
ServerCertificate
string
Should we require that the remote HTTP server have a valid SSL Certificate for HTTPS? (This only applies to Outgoing AS2 message from Files.com to a Partner.)
Possible values: require_match, allow_any
HttpAuthUsername
string
Username to send to server for HTTP Authentication.
AdditionalHttpHeaders
object
Additional HTTP Headers for outgoing message sent to this partner.
DefaultMimeType
string
Default mime type of the file attached to the encrypted message
MdnValidationLevel
string
How should Files.com evaluate message transfer success based on a partner's MDN response? This setting does not affect MDN storage; all MDNs received from a partner are always stored. none: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. weak: Inspect the MDN for MIC and Disposition only. normal: weak plus validate MDN signature matches body, strict: normal but do not allow signatures from self-signed or incorrectly purposed certificates. auto: Automatically set the correct value for this setting based on next mdn received.
Possible values: none, weak, normal, strict, auto
SignatureValidationLevel
string
Should Files.com require signatures on incoming AS2 messages? normal: require that incoming messages are signed with a valid matching signature. none: Unsigned incoming messages are allowed. auto: Automatically set the correct value for this setting based on next message received.
Possible values: normal, none, auto
EnableDedicatedIps
boolean
If true, we will use your site's dedicated IPs for all outbound connections to this AS2 Partner.
HexPublicCertificateSerial
string
Serial of public certificate used for message security in hex format.
PublicCertificate
string
Public certificate used for message security.
PublicCertificateMd5
string
MD5 hash of public certificate 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.