Links

Upload Photo

Upload a photo for a user. This function is only available through a JWT token, and is not available for all users.
post
https://studio.edgeimpulse.com/v1
/api/users/{userId}/photo
Upload photo

Upload a photo for a user. This function is only available through a JWT token, and is not available for all users.

Parameters
Path
userId*
integer
User ID
Body
Example
Schema
{
"photo": "string"
}
Responses
200: OK
OK
python
cURL
Node.js
import requests, io
JWT_TOKEN = 'YOUR_JWT_TOKEN'
r = requests.post(
'https://studio.edgeimpulse.com/v1/api/user/photo',
cookies={
'jwt': JWT_TOKEN
},
files=(
('photo', ('Jan-Jongboom.jpg', open('/Users/janjongboom/Downloads/Jan-Jongboom.jpg', 'rb'), 'image/jpeg')),
)
)
print('returned', r, r.content)
curl -X POST https://studio.edgeimpulse.com/v1/api/user/photo \\
-b \"jwt=YOUR_JWT_TOKEN\" \\
-F photo=@/Users/janjongboom/Downloads/Jan-Jongboom.jpg
const request = require('request');
const fs = require('fs');
const JWT_TOKEN = 'YOUR_JWT_TOKEN';
// Make the request with an empty 'formData' object, so we can manipulate this later
let req = request.post(`https://studio.edgeimpulse.com/v1/api/user/photo`, {
headers: {
'Content-Type': 'multipart/form-data',
'Cookie': 'jwt=' + JWT_TOKEN
},
formData: { }
}, (_err, resp, body) => {
if (_err) {
return console.error('Error when doing request', _err);
}
else if (resp.statusCode !== 200) {
return console.error('statusCode was not 200, but ' + resp.statusCode);
}
else {
console.log('Request succeeded', body);
}
});
// the request actually gets sent at the next tick so we can still manipulate this
let form = req.form();
form.append('photo', fs.readFileSync('/Users/janjongboom/Downloads/Jan-Jongboom.jpg'), {
contentType: 'image/jpeg',
filename: 'Jan-Jongboom.jpg'
});