Create Saved Password
curl --request POST \
--url https://api.example.com/api/password-generator/save-passwords/ \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"user": 123,
"password_saved": "<string>",
"url": "<string>",
"name_pages": "<string>"
}
'import requests
url = "https://api.example.com/api/password-generator/save-passwords/"
payload = {
"user": 123,
"password_saved": "<string>",
"url": "<string>",
"name_pages": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({user: 123, password_saved: '<string>', url: '<string>', name_pages: '<string>'})
};
fetch('https://api.example.com/api/password-generator/save-passwords/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/password-generator/save-passwords/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user' => 123,
'password_saved' => '<string>',
'url' => '<string>',
'name_pages' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/password-generator/save-passwords/"
payload := strings.NewReader("{\n \"user\": 123,\n \"password_saved\": \"<string>\",\n \"url\": \"<string>\",\n \"name_pages\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/password-generator/save-passwords/")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"user\": 123,\n \"password_saved\": \"<string>\",\n \"url\": \"<string>\",\n \"name_pages\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/password-generator/save-passwords/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user\": 123,\n \"password_saved\": \"<string>\",\n \"url\": \"<string>\",\n \"name_pages\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"user": ["This field is required."],
"password_saved": ["This field is required."],
"url": ["This field is required."]
}
Saved Passwords
Create Saved Password
POST
/
api
/
password-generator
/
save-passwords
/
Create Saved Password
curl --request POST \
--url https://api.example.com/api/password-generator/save-passwords/ \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"user": 123,
"password_saved": "<string>",
"url": "<string>",
"name_pages": "<string>"
}
'import requests
url = "https://api.example.com/api/password-generator/save-passwords/"
payload = {
"user": 123,
"password_saved": "<string>",
"url": "<string>",
"name_pages": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({user: 123, password_saved: '<string>', url: '<string>', name_pages: '<string>'})
};
fetch('https://api.example.com/api/password-generator/save-passwords/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/password-generator/save-passwords/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user' => 123,
'password_saved' => '<string>',
'url' => '<string>',
'name_pages' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/password-generator/save-passwords/"
payload := strings.NewReader("{\n \"user\": 123,\n \"password_saved\": \"<string>\",\n \"url\": \"<string>\",\n \"name_pages\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/password-generator/save-passwords/")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"user\": 123,\n \"password_saved\": \"<string>\",\n \"url\": \"<string>\",\n \"name_pages\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/password-generator/save-passwords/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user\": 123,\n \"password_saved\": \"<string>\",\n \"url\": \"<string>\",\n \"name_pages\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"user": ["This field is required."],
"password_saved": ["This field is required."],
"url": ["This field is required."]
}
Saves a password for a specific URL or page. Requires authentication.
Endpoint
POST /api/password-generator/save-passwords/
Authentication
string
required
Bearer token for authentication. User must be logged in.
Request Body
integer
required
The user ID who is saving the password.
string
required
The password to be saved (max 200 characters).
string
required
The URL where this password is used (max 200 characters).
string
A friendly name for the page or service (max 200 characters).
Request Example
{
"user": 1,
"password_saved": "MySecureP@ss123",
"url": "https://example.com",
"name_pages": "Example Website"
}
Response
Success Response
200 OK
"password saved successfully"
Error Responses
{
"user": ["This field is required."],
"password_saved": ["This field is required."],
"url": ["This field is required."]
}
{
"error": "Missing required fields."
}
{
"error": "password does not exist after creation."
}
{
"error": "error message"
}
Example Request
curl -X POST https://api.example.com/api/password-generator/save-passwords/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"user": 1,
"password_saved": "MySecureP@ss123",
"url": "https://example.com",
"name_pages": "Example Website"
}'
fetch('https://api.example.com/api/password-generator/save-passwords/', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
user: 1,
password_saved: 'MySecureP@ss123',
url: 'https://example.com',
name_pages: 'Example Website'
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
data = {
'user': 1,
'password_saved': 'MySecureP@ss123',
'url': 'https://example.com',
'name_pages': 'Example Website'
}
response = requests.post(
'https://api.example.com/api/password-generator/save-passwords/',
headers=headers,
json=data
)
print(response.json())
Implementation Details
This endpoint is implemented inviews.py:32 using the save_passwords view function. It validates the request data using SavedPasswordsSerializer and saves the password to the database associated with the authenticated user.⌘I
