---
name: "up.Params"
area: "API"
kind: "class"
parent: "up.form module"
url: "https://unpoly.com/api/up.Params"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.form module](https://unpoly.com/api/up.form.md)</nav>

# `up.Params`

The `up.Params` class offers a consistent API to read and manipulate request parameters independent of their type.

Request parameters are used in [form submissions](https://unpoly.com/api/up.Params.fromForm.md) and [URLs](https://unpoly.com/api/up.Params.fromURL.md). Methods like [`up.submit()`](https://unpoly.com/api/up.submit.md) or [`up.render()`](https://unpoly.com/api/up.render.md) accept request parameters as a `{ params }` option.

## Supported parameter types {#supported-parameter-types}

The following types of parameter representation are supported:

1. An object like `{ email: 'foo@bar.com' }`
2. A query string like `'email=foo%40bar.com'`
3. An array of `{ name, value }` objects like `[{ name: 'email', value: 'foo@bar.com' }]`
4. A [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object.

---

## Features {#features}

- ### [new up.Params([params])](https://unpoly.com/api/up.Params.new.md) (Class constructor)

  Constructs a new `up.Params` instance.

- ### [up.Params.prototype.add(name, value)](https://unpoly.com/api/up.Params.prototype.add.md) (Instance method)

  Adds a new entry with the given `name` and `value`.

- ### [up.Params.prototype.addAll(params)](https://unpoly.com/api/up.Params.prototype.addAll.md) (Instance method)

  Adds all entries from the given list of params.

- ### [up.Params.prototype.addField(field, [options])](https://unpoly.com/api/up.Params.prototype.addField.md) (Instance method) (experimental)

  Adds params from the given HTML form field.

- ### [up.Params.prototype.clear()](https://unpoly.com/api/up.Params.prototype.clear.md) (Instance method)

  Removes all params from this object.

- ### [up.Params.prototype.delete(name)](https://unpoly.com/api/up.Params.prototype.delete.md) (Instance method)

  Deletes all entries with the given `name`.

- ### [up.Params.prototype.get(name)](https://unpoly.com/api/up.Params.prototype.get.md) (Instance method)

  Returns the first param value with the given `name`.

- ### [up.Params.prototype.getAll(name)](https://unpoly.com/api/up.Params.prototype.getAll.md) (Instance method) (experimental)

  Returns an array of all param values with the given `name`.

- ### [up.Params.prototype.getFirst(name)](https://unpoly.com/api/up.Params.prototype.getFirst.md) (Instance method) (experimental)

  Returns the first param value with the given `name`.

- ### [up.Params.prototype.set(name, value)](https://unpoly.com/api/up.Params.prototype.set.md) (Instance method)

  Sets the `value` for the entry with given `name`.

- ### [up.Params.prototype.toArray()](https://unpoly.com/api/up.Params.prototype.toArray.md) (Instance method) (experimental)

  Returns an array representation of this `up.Params` instance.

- ### [up.Params.prototype.toFormData()](https://unpoly.com/api/up.Params.prototype.toFormData.md) (Instance method)

  Returns a `FormData` representation of this `up.Params` instance.

- ### [up.Params.prototype.toObject()](https://unpoly.com/api/up.Params.prototype.toObject.md) (Instance method) (experimental)

  Returns an object representation of this `up.Params` instance.

- ### [up.Params.prototype.toQuery()](https://unpoly.com/api/up.Params.prototype.toQuery.md) (Instance method)

  Returns a query string for this `up.Params` instance.

- ### [up.Params.prototype.toURL(base)](https://unpoly.com/api/up.Params.prototype.toURL.md) (Instance method) (experimental)

  Builds a URL string from the given base URL and this `up.Params` instance as a query string.

- ### [up.Params.fromContainer(container, [options])](https://unpoly.com/api/up.Params.fromContainer.md) (Class method) (experimental)

  Constructs a new `up.Params` instance from the fields within the given container.

- ### [up.Params.fromFields(fields)](https://unpoly.com/api/up.Params.fromFields.md) (Class method) (experimental)

  Constructs a new `up.Params` instance from one or more HTML form fields.

- ### [up.Params.fromForm(form, [options])](https://unpoly.com/api/up.Params.fromForm.md) (Class method)

  Constructs a new `up.Params` instance from the given `<form>`.

- ### [up.Params.fromURL(url)](https://unpoly.com/api/up.Params.fromURL.md) (Class method)

  Constructs a new `up.Params` instance from the given URL's query string.

- ### [up.Params.stripURL(url)](https://unpoly.com/api/up.Params.stripURL.md) (Class method) (experimental)

  Returns the given URL without its query string.

