Documentation Gardenlab
Français
Rechercher
K

Partners API

Description of the API that can be used by partners to update the NFT

Introduction

A partner API is being developed and allows third party to trigger actions in a NFT collection on Gardenlab.
For now, the API allows partners to trigger NFT creation and reservation for later claim by the user. The claim shall be performed by the user, after logging in with its email. It also allows to consume an interaction on a NFT, designated by the owner's email address. The interaction shall be created and configured beforehand on the collection admin tool.
An API key and a configured collection are required to properly perform those actions.

Description

Configuration

Interactions

post
https://demo.gardenlab.io/api/v1
/saveActionInteraction

Operation

User creation

post
https://demo.gardenlab.io/api/v1
/newUserForPartner
Note: When creating a NFT for a user, this NFT is prepared but not minted. The mint of the NFT occurs when the user claims it using the email address.

Action

post
https://demo.gardenlab.io/api/v1
/newActionForUser
Note: The action saved for a NFT is applied if the NFT is minted or not.

Mint token

post
https://demo.gardenlab.io/api/v1
/mintTokenForUser

Getters

get
https://demo.gardenlab.io/api/v1
/getNftByTokenId
get
https://demo.gardenlab.io/api/v1
/getAllInteractions
get
https://demo.gardenlab.io/api/v1
/getAllInteractionScansForToken
get
https://demo.gardenlab.io/api/v1
/getBlockchainTxForToken

Webhooks

It is also possible to set up webhooks to get notified about some specific events occuring in Gardenlab.
The failure object is sent only when there is no "hope" about succeeding in performing the blockchain transactions. Gardenlab system is designed to try multiple times to perform a transaction if no fatal error occurs on the transaction.

New interaction with blockchain update:

Type :

newBcInteraction
"X-API-key": string // The API key configured by the partner

Success Content:

{
sucess: true,
contract: string, // The contract address
tokenId: string, // The token ID
actionType: string, // The webhook/action type (newBcInteraction)
actionAtInSeconds: string, // The date of the action in seconds
at: {"_seconds": number, "_nanoseconds": number}, // The date in an object
transactionUrl: string, // The blockchain explorer page for this transaction
txHash: string, // The blockchain transaction hash
newUri: string, // The new URI of the token
}

Failure Content:

{
sucess: false,
error: string,
contract: string, // The contract address
tokenId: string, // The token ID
actionType: string, // The webhook/action type (newBcInteraction)
actionAtInSeconds: string, // The date of the action in seconds
at: {"_seconds": number, "_nanoseconds": number}, // The date in an object
}

New NFT minted:

Type :

newBcNftMint

Header:

"X-API-key": string // The API key configured by the partner

Success content:

{
success: true,
contract: string, // The contract address
tokenId: string, // The token ID
actionType: string, // The webhook/action type (newBcNftMint)
at: {"_seconds": number, "_nanoseconds": number}, // The date in an object
transactionUrl: string, // The blockchain explorer page for this transaction
txHash: string, // The blockchain transaction hash
}

Failure content:

{
success: false,
error: string, // The error message
contract: string, // The contract address
tokenId: string, // The token ID
actionType: string, // The webhook/action type (newBcNftMint)
at: {"_seconds": number, "_nanoseconds": number}, // The date in an object
}