site/logo.png (PUT)
Overview
Save a new site logo image
- REST Method: PUT
- Method Access: internal
Query Parameters
Name | Type | Description |
authenticate | bool? | Force authentication for request (default: false) |
Message Format
Input:
Content-type=image/*
Implementation Notes
The logo image is converted to PNG with a width and height specified by the ui/logo-maxwidth and ui/logo-maxheight config settings. You can also make a call to PUT:site/logo and achieve the same results.
C# Sample: Set Site Logo
The following code example uploads the file "myfile.jpg" as the site logo:
Sample Code
Plug p = Plug.New("http://deki-hayes/@api/deki"); p.At("users", "authenticate").WithCredentials("admin", "password").Get(); DreamMessage msg = DreamMessage.FromFile("c:\\temp\\myfile.jpg"); msg = p.At("site", "logo").Put(msg);
Implementation notes
Add notes about requirements or config values
Curl Sample: Set Site Logo
The following command sets foo.jpg as the site logo.
Sample Code
curl -u admin:password -H "Content-Type: image/jpg" -T foo.jpg http://192.168.168.110/site/logo
Implementation notes
curl flags
- -u
- Basic HTTP authentication. Sends a username and password to server so it can verify whether a user is of privilege to perform specific operation.
- -T file
- Specifies a PUT request and the file to send.
- -H
- Replaces or appends an HTTP header. The "Content-Type" header specifies the MIME type of the image. Make sure the correct type is used or the image might not display correctly.
- -i
- Includes the HTTP response header in the output. Useful for debugging.
Permissions
- ADMIN permission is required to execute above command. Otherwise, a 403 HTTP response (Forbidden) will be returned.
Example
The following command sets trollface.jpg as the site logo.
Sample Code
curl -u admin:password -H "Content-Type: image/jpg" -T trollface.jpg -i http://192.168.168.110/@api/deki/site/logo
HTTP Response Headers
HTTP/1.1 200 OK Date: Wed, 13 Jan 2010 21:45:46 GMT Server: Dream-HTTPAPI/1.7.2.17433 Content-Disposition: inline; creation-date="Wed, 13 Jan 2010 21:45:45 GMT"; filename="logo.png"; size=20827 Cache-Control: must-revalidate,private Vary: Accept-Encoding Last-Modified: Wed, 13 Jan 2010 21:45:45 GMT ETag: Wed, 13 Jan 2010 21:45:45 GMT X-Deki-Site: id="default" Content-Type: image/png Content-Length: 20827 Via: 1.1 dekiwiki