Skip to content

Latest commit

 

History

History
181 lines (127 loc) · 11.9 KB

File metadata and controls

181 lines (127 loc) · 11.9 KB

Organizations

Overview

Available Operations

get

Retrieve a single organization by its ID.

You can normally only retrieve the currently authenticated organization with this endpoint. This is primarily useful for OAuth apps. See also Get current organization.

If you have a partner account', you can retrieve organization details of connected organizations.

Example Usage

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.errors.ErrorResponse;
import com.mollie.mollie.models.operations.GetOrganizationResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorResponse, Exception {

        Client sdk = Client.builder()
                .testmode(false)
                .security(Security.builder()
                    .organizationAccessToken(System.getenv().getOrDefault("ORGANIZATION_ACCESS_TOKEN", ""))
                    .build())
            .build();

        GetOrganizationResponse res = sdk.organizations().get()
                .organizationId("org_1234567")
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .call();

        if (res.entityOrganization().isPresent()) {
            System.out.println(res.entityOrganization().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
organizationId String ✔️ Provide the ID of the related organization. org_1234567
testmode Optional<Boolean> You can enable test mode by setting the testmode query parameter to true.

Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
idempotencyKey Optional<String> A unique key to ensure idempotent requests. This key should be a UUID v4 string. 123e4567-e89b-12d3-a456-426

Response

GetOrganizationResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorResponse 404 application/hal+json
models/errors/APIException 4XX, 5XX */*

getCurrent

Retrieve the currently authenticated organization. A convenient alias of the Get organization endpoint.

For a complete reference of the organization object, refer to the Get organization endpoint documentation.

Example Usage

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.operations.GetCurrentOrganizationResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Client sdk = Client.builder()
                .security(Security.builder()
                    .organizationAccessToken(System.getenv().getOrDefault("ORGANIZATION_ACCESS_TOKEN", ""))
                    .build())
            .build();

        GetCurrentOrganizationResponse res = sdk.organizations().getCurrent()
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .call();

        if (res.entityOrganization().isPresent()) {
            System.out.println(res.entityOrganization().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
idempotencyKey Optional<String> A unique key to ensure idempotent requests. This key should be a UUID v4 string. 123e4567-e89b-12d3-a456-426

Response

GetCurrentOrganizationResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

getPartner

Retrieve partnership details about the currently authenticated organization. Only relevant for so-called partner accounts.

Example Usage

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.operations.GetPartnerStatusResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Client sdk = Client.builder()
                .security(Security.builder()
                    .organizationAccessToken(System.getenv().getOrDefault("ORGANIZATION_ACCESS_TOKEN", ""))
                    .build())
            .build();

        GetPartnerStatusResponse res = sdk.organizations().getPartner()
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .call();

        if (res.object().isPresent()) {
            System.out.println(res.object().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
idempotencyKey Optional<String> A unique key to ensure idempotent requests. This key should be a UUID v4 string. 123e4567-e89b-12d3-a456-426

Response

GetPartnerStatusResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*