Documentation Gardenlab
Français
Français
  • 👋Introduction
  • 💾Technologie
  • 🚀Admin - Get Started
  • 📖Learn
    • NFT
      • La valeur
  • 💫Use cases
    • ⚽Sport (Fan Experience)
    • 🎲Bars à jeux
    • 🛒Centres Commerciaux
    • 🏨Clubs vacances (hôtels,campings)
  • 👨‍💻API
    • Partners API
  • ⚖️Notices Légales
    • Politique de confidentialité
    • Conditions générales d'utilisation
    • Mentions Légales
Propulsé par GitBook
Sur cette page
  1. API

Partners API

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

PrécédentClubs vacances (hôtels,campings)SuivantPolitique de confidentialité

Dernière mise à jour il y a 10 mois

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.

Swagger demo API :

Description

Configuration

Interactions

Operation

User creation

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

Note: The action saved for a NFT is applied if the NFT is minted or not.

Mint token

Getters

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

Header:

"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
}
👨‍💻
https://api-docs-demo.gardenlab.io/
Page cover image
get

Getting all the blockchain transactions for a specific token, with the information related to the transaction.

Autorisations
Paramètres de requête
originstringRequis

The partner's name.

Example: spacex
contract_idstringRequis

The contract ID associated with a specific contract/collection/customer (ex: the event ID or 'subscription')

Example: summer_party
token_idstringRequis

The token ID for which to retrieve the blockchain transactions

Example: summer_party
Réponses
200
Returns a list with all the blockchain transactions
application/json
400
There is an error in the query.
application/json
403
The API key is missing or incorrect.
application/json
500
An internal error occured. Check the error message.
application/json
get
GET /api/v1/getBlockchainTxForToken HTTP/1.1
Host: demo.gardenlab.io
Authorization: Bearer JWT
Accept: */*
[
  {
    "txHash": "text",
    "transactionUrl": "text",
    "newUri": "text",
    "at": {
      "_seconds": 1,
      "_nanoseconds": 1
    },
    "xpBefore": 1,
    "xpAfter": 1,
    "lvlBefore": 1,
    "lvlAfter": 1,
    "maxLvlReached": true,
    "interactionName": "text",
    "type": "text"
  }
]
get

Retrieve the information on a specific NFT of a contract.

Autorisations
Paramètres de requête
contractstringOptionnel

The contract address of the token.

tokenIdintegerOptionnel

The token ID

Réponses
200
Returns an object containing the NFT information.
400
There is an error in the query.
application/json
403
The API key is missing or incorrect.
application/json
404
The specified NFT cannot be found in Gardenlab database.
application/json
get
GET /api/v1/getNftByTokenId HTTP/1.1
Host: demo.gardenlab.io
Authorization: Bearer JWT
Accept: */*

Aucun contenu

get

Retrieve all the interactions for a contract.

Autorisations
Paramètres de requête
originstringRequis

The partner's name.

Example: spacex
contractstringOptionnel

The contract for which to retrieve the interactions

Example: 0x0123456789abcdef0123456789abcdef01234567
contract_idstringOptionnel

The contract ID associated with a specific contract/collection/customer (ex: the event ID or 'subscription')

Example: summer_party
Réponses
200
Returns a list with all the interactions
application/json
400
There is an error in the query.
application/json
403
The API key is missing or incorrect.
application/json
500
An internal error occured. Check the error message.
application/json
get
GET /api/v1/getAllInteractions HTTP/1.1
Host: demo.gardenlab.io
Authorization: Bearer JWT
Accept: */*
[
  {
    "type": "IRL Event",
    "name": "Event checkin",
    "description": "The interaction applied when a user get access to the event",
    "xpIncrement": 5,
    "noXp": false,
    "customXpIncrement": false,
    "authScanCount": 1,
    "action_id": "event_checkin"
  }
]
get

Getting all the actions applied on a NFT

Autorisations
Paramètres de requête
originstringRequis

The partner's name.

Example: spacex
tokenIdstringRequis

The token ID to fetch the interactions for

Example: 123
contractstringOptionnel

The contract for which to retrieve the interactions

Example: 0x0123456789abcdef0123456789abcdef01234567
contract_idstringOptionnel

The contract ID associated with a specific contract/collection/customer (ex: the event ID or 'subscription')

Example: summer_party
Réponses
200
Returns a list with all the interactions
application/json
400
There is an error in the query.
application/json
403
The API key is missing or incorrect.
application/json
500
An internal error occured. Check the error message.
application/json
get
GET /api/v1/getAllInteractionScansForToken HTTP/1.1
Host: demo.gardenlab.io
Authorization: Bearer JWT
Accept: */*
[
  {
    "at": {
      "_seconds": 1,
      "_nanoseconds": 1
    },
    "xpBefore": 1,
    "xpAfter": 1,
    "lvlBefore": 1,
    "lvlAfter": 1,
    "maxLvlReached": true,
    "interactionName": "text",
    "type": "text"
  }
]
  • Introduction
  • Description
  • Configuration
  • POST/saveActionInteraction
  • Operation
  • POST/newUserForPartner
  • POST/newActionForUser
  • POST/mintTokenForUser
  • Getters
  • GET/getNftByTokenId
  • GET/getAllInteractions
  • GET/getAllInteractionScansForToken
  • GET/getBlockchainTxForToken
  • Webhooks
  • New interaction with blockchain update:
  • New NFT minted
post

Create or update a new interaction and specify the action_id to use to apply the interaction.

Autorisations
Corps
originstringRequis

The partner's name.

Example: spacex
contract_idstringRequis

The contract ID associated with a specific contract/collection/customer (ex: the event ID or 'subscription')

Example: summer_party
interactionIdstringOptionnel

(optional) The interaction ID to edit. Leave empty to create.

Example: 0ER368760G8787238
Réponses
200
Returns an object containing the interaction information along with its id.
application/json
400
The request is malformed. Please verify the content of the body.
application/json
403
The API key is missing or incorrect.
application/json
500
An internal error occured. Check the error message.
application/json
post
POST /api/v1/saveActionInteraction HTTP/1.1
Host: demo.gardenlab.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 319

{
  "origin": "spacex",
  "contract_id": "summer_party",
  "interactionId": "0ER368760G8787238",
  "interaction": {
    "type": "IRL Event",
    "name": "Event checkin",
    "description": "The interaction applied when a user get access to the event",
    "xpIncrement": 5,
    "noXp": false,
    "customXpIncrement": false,
    "authScanCount": 1,
    "action_id": "event_checkin"
  }
}
{
  "interaction": {
    "type": "IRL Event",
    "name": "Event checkin",
    "description": "The interaction applied when a user get access to the event",
    "xpIncrement": 5,
    "noXp": false,
    "customXpIncrement": false,
    "authScanCount": 1,
    "action_id": "event_checkin"
  },
  "id": "IQ0LuundpiAvnfDcQ21Y"
}
post

Notifies Gardenlab that a user has performed an action in the partner ecosystem

Autorisations
Corps
originstringOptionnel

The partner's name.

Example: spacex
contract_idstringOptionnel

The contract ID associated with a specific contract/collection/customer (ex: the event ID or 'subscription')

Example: summer_party
action_idstringOptionnel

The action ID.

Example: eshop_purchase
xpIncrementnumberOptionnel

The XP value to add on the NFT. Applied only if the interaction allows it.

Example: 5
Réponses
200
Returns an object containing the NFT created for the user.
application/json
400
The request is malformed. Please verify the content of the body.
application/json
403
The API key is missing or incorrect.
application/json
500
An internal error occured. Check the error message.
application/json
post
POST /api/v1/newActionForUser HTTP/1.1
Host: demo.gardenlab.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 131

{
  "origin": "spacex",
  "contract_id": "summer_party",
  "action_id": "eshop_purchase",
  "xpIncrement": 5,
  "guest": {
    "email": "text",
    "uid": "text"
  }
}
{
  "contract": "0x0123456789abcdef0123456789abcdef01234567",
  "tokenId": "123",
  "attributes": {},
  "url": "text",
  "uid": "text",
  "email": "text"
}
post

Notifies Gardenlab that a user has been created in the database. Create and reserve a NFT for the user, if the conditions are respected. The NFT associated to user_category_id will be used for this user. This endpoint supports body with an array of requests or a single request. The response will be an array or a single body accordingly.

Autorisations
Corps
originstringRequis

The partner's name.

Example: spacex
emailstringRequis

The user's email address. The NFT created will be reserved to this email.

uidstringRequis

The user identification.

user_category_idstringRequis

The user catagory. This defines which NFT to distribute.

Example: VIP
contract_idstringRequis

The contract ID associated with a specific contract/collection/customer (ex: the event ID or 'subscription')

Example: summer_party
Réponses
200
Returns an array of object containing the NFTs created for the user.
application/json
Réponseany of[]
400
The request is not valid or an error occured.
application/json
403
The API key is missing or incorrect.
application/json
500
An internal error occured. Please verify the message
application/json
post
POST /api/v1/newUserForPartner HTTP/1.1
Host: demo.gardenlab.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 269

[
  {
    "origin": "spacex",
    "email": "text",
    "uid": "text",
    "user_category_id": "VIP",
    "contract_id": "summer_party",
    "additional_fields": {
      "expiration_date": "2023-09-18T12:34:56.123Z",
      "max_level": 15
    },
    "nft_info": {
      "imgUrl": "text",
      "name": "text",
      "description": "text",
      "attributes": "text"
    }
  }
]
[
  {
    "contract": "0x0123456789abcdef0123456789abcdef01234567",
    "tokenId": "123",
    "attributes": {},
    "url": "text",
    "uid": "text",
    "email": "text"
  }
]
post

Mint an existing token to a user. The token must be created and allocated to a user, through his email address. The NFT will then be minted to the blockchain address specified in the request. The UID of the user must also be specified for additional security.

Autorisations
Corps
originstringRequis

The partner's name.

Example: spacex
emailstringRequis

The user's email address. The NFT must have been created with this email.

Example: max@gardenlab.io
uidstringRequis

The user identification.

Example: u123456789
user_addrstringRequis

The blockchain address of the user. The NFT will be minted to this address.

Example: 0x0123456789abcdef0123456789abcdef01234567
contract_idstringRequis

The contract ID associated with a specific contract/collection/customer (ex: the event ID or 'subscription')

Example: summer_party
contractstringOptionnel

The contract address. Required if contract_id is not specified. The contract must be associated to the partner.

Example: 0x0123456789abcdef0123456789abcdef01234567
token_idstringOptionnel

The token ID to be minted. It must be reserved to the user. If not specified, the token ID will be searched using the user email.

Example: 123
Réponses
200
Returns the basic information of the mint. The mint is not yet processed in the blockchain.
application/json
400
The request is not valid or an error occured.
application/json
403
The API key is missing or incorrect.
application/json
500
An internal error occured. Please verify the message
application/json
post
POST /api/v1/mintTokenForUser HTTP/1.1
Host: demo.gardenlab.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 224

{
  "origin": "spacex",
  "email": "max@gardenlab.io",
  "uid": "u123456789",
  "user_addr": "0x0123456789abcdef0123456789abcdef01234567",
  "contract_id": "summer_party",
  "contract": "0x0123456789abcdef0123456789abcdef01234567",
  "token_id": "123"
}
{
  "userAddr": "0x0123456789abcdef0123456789abcdef01234567",
  "contract": "0x0123456789abcdef0123456789abcdef01234567",
  "tokenId": "123",
  "tokenUrl": "ipfs://bafyreid2zqtuvrcemlhesksvibci7xaphbvw4ytun5xykdjancfaum2l3i/metadata.json"
}