1import requests
2
3# Update an existing attribute
4response = requests.patch('http://www.example.com/api/products/attributes/123',
5 json={
6 'name': 'Updated Color',
7 'description': 'Updated description for the color attribute'
8 },
9 headers={'Authorization': 'Token <your_api_key>'}
10)
11print(response.json())
12
13# Update another attribute
14
15response = requests.patch('http://www.example.com/api/products/attributes/456',
16 json={
17 'name': 'Updated Size',
18 'description': 'Updated description for the size attribute'
19 },
20 headers={'Authorization': 'Token <your_api_key>'}
21)
22print(response.json())
1# Update an existing attribute
2
3curl -X PATCH "http://www.example.com/api/products/attributes/123" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{
4 "name": "Updated Color",
5 "description": "Updated description for the color attribute"
6}'
7
8# Update another attribute
9
10curl -X PATCH "http://www.example.com/api/products/attributes/456" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{
11 "name": "Updated Size",
12 "description": "Updated description for the size attribute"
13}'