Endpoints

XP

This endpoint sends a create project request to the XP contract

POST https://api.xp-protocol.io/create-project

This should be the first step into the XP ecoysystem

Headers

Name
Type
Description

X-API-KEY

<Your-Key>

Get an API key from the Huddln team

Content-Type*

application/json

Request Body

Name
Type
Description

projectId*

0xf0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b

A 32 Byte string of what you would like the project ID to be. This is not updateable and can only be chosen once.

name*

test

Name this project with something that closely aligns to your company's name.

inputActions*

[{"name":"bought","points":200,"direction":0}]

An array of actions and their properties, use the examlpe provided to construct this object.

owners*

["0x0000000000000000000000000000000000000000","0x0000000000000000000000000000000000000001"]

An array of wallet addresses as strings that have full authority over this project,

updaters*

["0x0000000000000000000000000000000000000000","0x0000000000000000000000000000000000000001"]

An array of wallet addresses as strings that have permissions to call the updateScore() method for this project. This is used so that your backend can update the scoring system in a more scalable manner.

Update score of a wallet address

POST https://api.xp-protocol.io/update-score

In the XP ecosystem this function should be called any time you want to trigger a score change.

Request Body

Name
Type
Description

updateId*

0x2413fb3709b05939f04cf2e92f7d0897fc2596f9ad0b8a9ea855c7bfebaae892

A unique / semi unique (depending on the use-case) 32 byte string to associate with this update.

projectId*

0xf0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b

The 32 byte string ID of the project associated with this update.

actionName*

bought

A string of the action you would like to trigger against the particular wallet address. This action must already exist in the project's list of actions.

scoreType*

reputation

A string that indicates which score type you would like this action to accumulate on. This score type must already exist within the project.

targetWallet*

0xE6F7e0aDD15c665f5AC2B0eeDFd2e8578EF2bf8A

The address as a string that you would like to update the score on.

signature*

<0x....>

Create a signature from the message "${Date.now().toString()}" , A full example is provided below.

message*

1656535069845

A string generated from JS Date.now().toString(), this is a string that represents the current epoch time in milliseconds.

More endpoints coming soon...

Example Request

The below request demonstrates how to perform a POST call to the /update-score endpoint with an X-API-KEY & Signature provided by either an "updater" or an "owner" of the project.

Last updated

Was this helpful?