Organizations
List Organizations
List organizations.
Scopes: organizations:read organizations:write
GET
/
v1
/
organizations
/
Go (SDK)
package main
import(
"context"
"os"
macropaygo "github.com/web3group/macropay-go-main"
"log"
)
func main() {
ctx := context.Background()
s := macropaygo.New(
macropaygo.WithSecurity(os.Getenv("MACROPAY_ACCESS_TOKEN")),
)
res, err := s.Organizations.List(ctx, nil, macropaygo.Pointer[int64](1), macropaygo.Pointer[int64](10), nil)
if err != nil {
log.Fatal(err)
}
if res.ListResourceOrganization != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}from macropay_sdk import Macropay
with Macropay(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as macropay:
res = macropay.organizations.list(page=1, limit=10)
while res is not None:
# Handle items
res = res.next()import { Macropay } from "@macropayments/sdk";
const macropay = new Macropay({
accessToken: process.env["MACROPAY_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await macropay.organizations.list({});
for await (const page of result) {
console.log(page);
}
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Macropay;
$sdk = Macropay\Macropay::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$responses = $sdk->organizations->list(
page: 1,
limit: 10
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}curl --request GET \
--url https://api.macropay.ai/v1/organizations/ \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.macropay.ai/v1/organizations/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.macropay.ai/v1/organizations/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.macropay.ai/v1/organizations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"items": [
{
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"avatar_url": "<string>",
"allow_customer_updates": true,
"email": "<string>",
"website": "<string>",
"socials": [
{
"url": "<string>"
}
],
"details_submitted_at": "2023-11-07T05:31:56Z",
"feature_settings": {
"issue_funding_enabled": false,
"seat_based_pricing_enabled": false,
"revops_enabled": false,
"wallets_enabled": false,
"member_model_enabled": false
},
"subscription_settings": {
"allow_multiple_subscriptions": true,
"allow_customer_updates": true,
"benefit_revocation_grace_period": 123,
"prevent_trial_abuse": true
},
"notification_settings": {
"new_order": true,
"new_subscription": true
},
"customer_email_settings": {
"order_confirmation": true,
"subscription_cancellation": true,
"subscription_confirmation": true,
"subscription_cycled": true,
"subscription_past_due": true,
"subscription_revoked": true,
"subscription_uncanceled": true,
"subscription_updated": true
},
"customer_portal_settings": {
"usage": {
"show": true
},
"subscription": {
"update_seats": true,
"update_plan": true
}
}
}
],
"pagination": {
"total_count": 123,
"max_page": 123
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
You can generate an Organization Access Token from your organization's settings.
Query Parameters
Filter by slug.
Page number, defaults to 1.
Size of a page, defaults to 10. Maximum is 100.
Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.
Available options:
created_at, -created_at, slug, -slug, name, -name, next_review_threshold, -next_review_threshold, days_in_status, -days_in_status ⌘I
Go (SDK)
package main
import(
"context"
"os"
macropaygo "github.com/web3group/macropay-go-main"
"log"
)
func main() {
ctx := context.Background()
s := macropaygo.New(
macropaygo.WithSecurity(os.Getenv("MACROPAY_ACCESS_TOKEN")),
)
res, err := s.Organizations.List(ctx, nil, macropaygo.Pointer[int64](1), macropaygo.Pointer[int64](10), nil)
if err != nil {
log.Fatal(err)
}
if res.ListResourceOrganization != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}from macropay_sdk import Macropay
with Macropay(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as macropay:
res = macropay.organizations.list(page=1, limit=10)
while res is not None:
# Handle items
res = res.next()import { Macropay } from "@macropayments/sdk";
const macropay = new Macropay({
accessToken: process.env["MACROPAY_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await macropay.organizations.list({});
for await (const page of result) {
console.log(page);
}
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Macropay;
$sdk = Macropay\Macropay::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$responses = $sdk->organizations->list(
page: 1,
limit: 10
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}curl --request GET \
--url https://api.macropay.ai/v1/organizations/ \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.macropay.ai/v1/organizations/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.macropay.ai/v1/organizations/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.macropay.ai/v1/organizations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"items": [
{
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"avatar_url": "<string>",
"allow_customer_updates": true,
"email": "<string>",
"website": "<string>",
"socials": [
{
"url": "<string>"
}
],
"details_submitted_at": "2023-11-07T05:31:56Z",
"feature_settings": {
"issue_funding_enabled": false,
"seat_based_pricing_enabled": false,
"revops_enabled": false,
"wallets_enabled": false,
"member_model_enabled": false
},
"subscription_settings": {
"allow_multiple_subscriptions": true,
"allow_customer_updates": true,
"benefit_revocation_grace_period": 123,
"prevent_trial_abuse": true
},
"notification_settings": {
"new_order": true,
"new_subscription": true
},
"customer_email_settings": {
"order_confirmation": true,
"subscription_cancellation": true,
"subscription_confirmation": true,
"subscription_cycled": true,
"subscription_past_due": true,
"subscription_revoked": true,
"subscription_uncanceled": true,
"subscription_updated": true
},
"customer_portal_settings": {
"usage": {
"show": true
},
"subscription": {
"update_seats": true,
"update_plan": true
}
}
}
],
"pagination": {
"total_count": 123,
"max_page": 123
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}