EDataServer.WebDAVSession.put_sync

### Method

# EDataServer WebDAVSessionput_sync

since: 3.26

#### Declaration [src]

    gboolean
    e_webdav_session_put_sync (
      EWebDAVSession* webdav,
      const gchar* uri,
      const gchar* etag,
      const gchar* content_type,
      SoupMessageHeaders* in_headers,
      GInputStream* stream,
      gssize stream_length,
      gchar** out_href,
      gchar** out_etag,
      SoupMessageHeaders** out_headers,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Writes data from `stream` to a resource identified by `uri` to the server. The URI cannot reference a collection.

The `etag` argument is used to avoid clashes when overwriting existing resources. It can contain three values: - `NULL` - to write completely new resource - empty string - write new resource or overwrite any existing, regardless changes on the server - valid ETag - overwrite existing resource only if it wasn’t changed on the server.

Note that the actual behaviour is also influenced by `ESourceWebdav:avoid-ifmatch` property of the associated `ESource`.

The optional `in_headers` can contain additional headers to be added to the request. These headers replace any existing in the request headers, without support for the list-values headers.

The `out_href`, if provided, is filled with the resulting URI of the written resource. It can be different from the `uri` when the server redirected to a different location.

The `out_etag` contains ETag of the resource after it had been saved.

The optional `out_headers` contains response headers. Free it with soup_message_headers_free(), when no longer needed.

The `stream` should support also `GSeekable` interface, because the data send can require restart of the send due to redirect or other reasons.

This method uses Transfer-Encoding:chunked, in contrast to the e_webdav_session_put_data_sync(), which writes data stored in memory like any other request.

Available since: 3.26

#### Parameters

`uri`

  Type: `const gchar*`

  URI of the resource to write.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`etag`

  Type: `const gchar*`

  An ETag of the resource, if it’s an existing resource, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`content_type`

  Type: `const gchar*`

  Content-Type of the `bytes` to be written.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`in_headers`

  Type: `SoupMessageHeaders`

  Additional `SoupMessageHeaders` to be added to the request, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`stream`

  Type: `GInputStream`

  A `GInputStream` with data to be written.

  The data is owned by the caller of the method.

`stream_length`

  Type: `gssize`

  Length of the `stream`, or -1 if unknown.

`out_href`

  Type: `gchar**`

  Optional return location for href of the resource, or `NULL`.

  The argument will be set by the function.
  The argument can be set to `NULL` by the method.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.
  The value is a NUL terminated UTF-8 string.

`out_etag`

  Type: `gchar**`

  Optional return location for etag of the resource, or `NULL`.

  The argument will be set by the function.
  The argument can be set to `NULL` by the method.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.
  The value is a NUL terminated UTF-8 string.

`out_headers`

  Type: `SoupMessageHeaders`

  Optional return location for response `SoupMessageHeaders`, or `NULL`.

  The argument will be set by the function.
  The argument can be `NULL`.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

Whether succeeded.