Petitions

Create a petition

Changed on

Creates a petition from given data

post/api/v2/petitions

Request

  • Base URL
    https://yournation.nationbuilder.com
  • Auth
    HTTP bearer

Request body

Example request

{
  "data": {
    "type": "petitions",
    "attributes": {
      "additional_signatures_count": 10,
      "auto_response_broadcaster_id": "1",
      "auto_response_content": "Auto response content",
      "auto_response_subject": "Auto response subject",
      "content": "Petition content",
      "goal": 5,
      "intro": "Petition intro",
      "page_id": "1",
      "petition_form_address": "required",
      "petition_form_phone": "optional",
      "signature_name": "endorsement"
    },
    "relationships": {
      "page": {
        "data": {
          "type": "pages",
          "temp-id": "new-id",
          "method": "create"
        }
      }
    }
  },
  "included": [
    {
      "type": "pages",
      "temp-id": "new-id",
      "attributes": {
        "site_id": "1",
        "parent_id": "1",
        "author_id": "1",
        "external_id": "abc",
        "slug": "your-slug",
        "status": "unlisted",
        "name": "Page Name",
        "headline": "Page headline",
        "title": "Page Title",
        "excerpt": "Page excerpt...",
        "page_type_name": "Petition",
        "permission_level": "anyone"
      }
    }
  ]
}

Response

The newly created petition.

metaobject

Non-standard information about the document. Empty unless the endpoint has metadata to convey.

Example response

{
  "data": {
    "id": "1",
    "type": "petitions",
    "attributes": {
      "additional_signatures_count": 10,
      "auto_response_broadcaster_id": "1",
      "auto_response_content": "Auto response content",
      "auto_response_subject": "Auto response subject",
      "content": "Petition content",
      "goal": 5,
      "intro": "Petition intro",
      "page_id": "1",
      "petition_form_address": "required",
      "petition_form_phone": "optional",
      "signature_name": "endorsement"
    }
  },
  "included": [
    {
      "type": "pages",
      "id": "1",
      "attributes": {
        "site_id": "1",
        "parent_id": "1",
        "author_id": "1",
        "external_id": "abc",
        "slug": "your-slug",
        "status": "unlisted",
        "name": "Page Name",
        "headline": "Page headline",
        "title": "Page Title",
        "excerpt": "Page excerpt...",
        "page_type_name": "Petition",
        "permission_level": "anyone",
        "parent_slug": "blog",
        "url_path": "/your-slug",
        "published_at": "2019-10-26T10:00:00-04:00",
        "ancestors_permission_level": "members",
        "effective_permission_level": "control_panel_users"
      },
      "temp-id": "new-id"
    }
  ]
}

Changes

    • breaking

      added subschema #2 to the request body allOf list

    • breaking

      the request's body type changed from object to no type

    • breaking

      the response's body type changed from object to no type for status

    • breaking

      removed the required property from the response with the status

    • warning

      removed the request property

    • warning

      removed the request property

    • warning

      removed the optional property from the response with the status

    • info

      added the media type application/vnd.api+json to the request body

    • info

      added subschema #2 to the response body allOf list for the response status

    • info

      media type application/json was changed to a more specific media type application/vnd.api+json for the response status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • breaking

      the request property /// became not nullable

    • breaking

      the request property /// became not nullable

    • breaking

      the request property /// became not nullable

    • breaking

      the request property /// became not nullable

    • breaking

      the / request property type changed from no type to object

    • warning

      removed from the / request property allOf list

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property ///

    • info

      added the new optional request property ///

    • info

      added the optional property // to the response with the status

    • info

      added the optional property /////// to the response with the status

    • info

      added the optional property /////// to the response with the status

    • info

      added the optional property /////// to the response with the status

    • info

      added the optional property /////// to the response with the status

    • info

      added the optional property /////// to the response with the status