Profiles play a central role, acting as the core for wallets, addresses, and transactions. When integrating a user into your system for blockchain interaction, having a wallet is key.
Profiles establish a direct link between your system's users and their corresponding wallets in ours. Creating a profile involves sending the user type and a reference, such as a UUID or email. This reference is necessary for tasks like generating addresses and handling transactions.
Everything starts with creating profile
Here are routes for profile management.
Create a profile
Make sure that you created an API Key from our dashboard , to start creating a profile
This operation creates a profile
POST
https://sandbox.oumla.com/api/v1/profiles
The API key generated from Oumla's dashboard
Request Body
Any identifer for this user this could be the UUID for the user or profile
One of the profile types.
User
| Department
| Merchant
Sample code of the request:
TypeScript TypeScript (Axios) Python
Copy async function createProfile(reference: string, type: string) {
const apiKey = "Your API Key";
const url = "https://sandbox.oumla.com/api/v1/profiles";
const data = JSON.stringify({ reference, type });
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": apiKey,
},
body: data,
});
const responseData = await response.json();
console.log(responseData);
}
// Example usage
createProfile("dba1fea5-2004-4ea8-a06d-a7c7c5559b8f", "User");
Copy import axios from "axios";
async function createProfile(reference: string, type: string) {
const apiKey = "Your API Key";
const url = "https://sandbox.oumla.com/api/v1/profiles";
try {
const response = await axios.post(url, {
reference,
type,
}, {
headers: {
"x-api-key": apiKey,
"Content-Type": "application/json",
},
});
console.log(response.data);
} catch (error) {
console.error("Error:", error);
}
}
// Example usage
createProfile("dba1fea5-2004-4ea8-a06d-a7c7c5559b8f", "User");
Copy import requests
import json
url = "https://sandbox.oumla.com/api/v1/profiles"
api_key = "Your API Key"
data = {
"reference": "dba1fea5-2004-4ea8-a06d-a7c7c5559b8f",
"type": "User"
}
headers = {
"Content-Type": "application/json",
"x-api-key": api_key
}
response = requests.post(url, data=json.dumps(data), headers=headers)
if response.status_code == 201:
print(response.json())
else:
print("Error:", response.status_code, response.text)
The expected response:
201: Created 400: Bad Request 404: Not Found
Copy {
"message": "Profile created",
"profile": {
"reference": "dba1fea5-2004-4ea8-a06d-a7c7c5559b8f",
"type": "User"
}
}
Check the type
it should only one of these profile types : User | Department | Merchant
Copy response: {
status: 400,
statusText: 'Bad Request',
// ...
},
The profile with this reference
is already exists.
Copy response: {
status: 404,
statusText: 'Not Found',
// ...
},
Get Profiles
This operation gets a profile
GET
https://sandbox.oumla.com/api/v1/profiles
Query Parameters (Optional)
to skip a certain number of rows
to get a certain number of rows
The API key generated from Oumla's dashboard
Sample code of the request:
TypeScript TypeScript (Axios) Python
Copy async function getProfiles() {
const apiKey = "Your API Key";
const url = "https://sandbox.oumla.com/api/v1/profiles";
const response = await fetch(url, {
method: "GET",
headers: {
"x-api-key": apiKey,
},
});
if (!response.ok) {
throw new Error(`Error fetching data: ${response.status}`);
}
const data = await response.json();
console.log(data);
}
// Example usage
getProfiles();
Copy import axios from "axios";
async function getProfiles() {
const apiKey = "Your API Key";
const url = "https://sandbox.oumla.com/api/v1/profiles";
try {
const response = await axios.get(url, {
headers: {
"x-api-key": apiKey,
},
});
console.log(response.data);
} catch (error) {
console.error("Error:", error);
}
}
// Example usage
getProfiles();
Copy import requests
response = requests.get('https://sandbox.oumla.com/api/v1/profiles', headers={
'x-api-key': 'Your API Key'
})
if response.status_code == 200:
print(response.json())
else:
print(response.text)
The expected response:
200: OK
Copy {
profiles: [
{
createdAt: '2024-01-17T09:32:29.546Z',
updated_at: '2024-01-17T09:32:29.546Z',
organizationId: '89a695b9-4c5f-4130-8b56-aff8010f8103',
type: 'User',
label: null,
reference: 'dba1fea5-2004-4ea8-a06d-a7c7c5559b8f',
miniWallets: [Array],
bitcoin_balance: [Object],
addressesCount: 0
},
// and the other profiles ...
],
skip: 0,
take: 10,
totalElements: 1,
totalPages: 1
}