Skip to content
Aller au contenu
Charitips

API reference · Votes

Create a vote

POST/v1/votes

This vote will then have to be casted i.e linked to a Charity.

Requires a Bearer access token.

Body

CreateVoteDto
  • campaignId#stringrequiredUUID

    Id of the campaign

  • weight#numberintegerminimum 1

    An optional weight to assign to this vote. Weight affects campaign's buget distribution amongs charities. Vote with larger weight will direct a larger amount of the campaign's budget towards a charity than one with a lesser weight. This is only useful if you want some votes to have more weights than others.

  • externalId#string

    An optional internal id of your system e.g orderId or customerId. Can be used to link a donation to an entity in your system. Votes can be queried using this field.

  • uniqueExternalId#string

    Similar to externalId but should be unique across all votes. Can be used to prevent duplicate votes.

  • donor#PartialDonor

    Only required for EMAIL or SLACK campaigns. Attach useful user data to votes for a better usage tracking.

    19 child fields
    • streetstring

      Address line 1

    • streetAdditionstring

      Address line 2

    • citystring

      City

    • countrystring

      Country alpha 2 ISO code

    • zipstring

      Zip code

    • firstNamestring

      Donor's first name

    • lastNamestring

      Donor's last name

    • emailstringemail address

      Donor's email.

    • companyNamestring

      Donor's company name.

    • phonestring

      Donor's phone number.

    • birthdatestring (date)

    • pictureUrlstringURL

      Donor's phone number.

    • titlestring

      Donor's job title.

    • personalEmailstringemail address

      Donor's personal email.

    • personastring

      Persona of the donor.

      CSRMARKETINGHRSALESCOMMUNICATIONPRODUCTSMBOTHER

    • extraInfostring

      Additional information about the donor.

    • externalIdstring

      Optional id to link this donor to an entity on your side.

    • uniqueExternalIdstring

      Similar to externalId but should be unique across all donors. Can be used to prevent duplicate donors

    • slackIdstring

      Donor's slack id. Required for SLACK campaigns.

  • language#string

    Locale to be used to communicate with the donor. Default to the campaign's language value.

    fren

  • sendingDate#string (date-time)

    Required for EMAIL and SLACK campaigns, when Charitips sends it to the donor.

Response

201 · Vote

No field is described in the spec.

  • voteId#stringalways returned

  • weight#number

  • status#VoteStatusalways returned

    PENDINGDONEPROCESSED

  • secret#stringalways returned

  • externalId#string

  • uniqueExternalId#string

  • castedAt#string (date-time)

  • validatedAt#string (date-time)

  • processedAt#string (date-time)

  • billingStatus#BillingStatusalways returned

    PENDINGBILLEDPAID

  • autoAssigned#boolean

  • sendingMode#CampaignSendingModealways returned

    MANUALEMAILPHYSICALSLACKPOSTAL

  • sendingDate#string (date-time)

  • sendingStatus#DonationSendingStatusalways returned

    PENDINGFAILEDDONE

  • lastReminderId#string

  • message#string

  • reminderMessage#string

  • from#string

  • language#Languagealways returned

    fren

  • sharedOn#SocialNetwork

    LINKEDININSTAGRAMFACEBOOKTWITTERWHATSAPP

  • accountId#stringalways returned

  • campaignId#stringalways returned

  • charityId#string

  • transactionId#string

  • donorId#string

  • createdAt#string (date-time)always returned

  • updatedAt#string (date-time)always returned

Errors

  • 400 Bad Request
  • Campaign is a FACE_VALUE one. Only donations can be created
    {
      "statusCode": 400,
      "message": "Campaign is a FACE_VALUE one. Only donations can be created",
      "error": "Bad Request"
    }
  • Votes cannot be posted.
    {
      "statusCode": 400,
      "message": "Votes cannot be posted.",
      "error": "Bad Request"
    }
  • donor is required for EMAIL campaigns.
    {
      "statusCode": 400,
      "message": "donor is required for EMAIL campaigns.",
      "error": "Bad Request"
    }
  • Both donor.email and donor.firstName are required for email campaigns
    {
      "statusCode": 400,
      "message": "Both donor.email and donor.firstName are required for email campaigns",
      "error": "Bad Request"
    }
  • donor is required for SLACK campaigns.
    {
      "statusCode": 400,
      "message": "donor is required for SLACK campaigns.",
      "error": "Bad Request"
    }
  • Both donor.slackId and donor.firstName are required for slack campaigns
    {
      "statusCode": 400,
      "message": "Both donor.slackId and donor.firstName are required for slack campaigns",
      "error": "Bad Request"
    }
  • A field is missing, has the wrong type, or is not part of the request schema.

    Every request with a body or query is validated.

    {
      "statusCode": 400,
      "message": [
        "amount must not be less than 1",
        "property foo should not exist"
      ],
      "error": "Bad Request"
    }
  • Bad Request

    No resource with this id on your account: the API answers as if it did not exist.

    {
      "statusCode": 400,
      "message": "Bad Request"
    }
  • 401 Unauthorized
  • Unauthorized

    Missing, expired or invalid access token.

    {
      "statusCode": 401,
      "message": "Unauthorized"
    }
  • 403 Forbidden
  • Campaign has ended.
    {
      "statusCode": 403,
      "message": "Campaign has ended.",
      "error": "Forbidden"
    }
  • Campaign has to be activated first.
    {
      "statusCode": 403,
      "message": "Campaign has to be activated first.",
      "error": "Forbidden"
    }
  • Only recurring donations can be created for recurring campaigns.
    {
      "statusCode": 403,
      "message": "Only recurring donations can be created for recurring campaigns.",
      "error": "Forbidden"
    }
  • Account not validated
    {
      "statusCode": 403,
      "message": "Account not validated",
      "error": "Forbidden"
    }
  • Account closed
    {
      "message": "Account closed",
      "code": "ACCOUNT_CLOSED"
    }
  • 409 Conflict
  • Unique constraint failed on uniqueExternalId

    {
      "statusCode": 409,
      "message": "Unique constraint failed on uniqueExternalId"
    }
POST /v1/votes
curl -X POST https://api.sandbox.charitips.com/v1/votes \  -H "Authorization: Bearer $CHARITIPS_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "campaignId": "<campaignId>",    "uniqueExternalId": "employee_4410"  }'
Built from the spec and the API code

Request bodies are written for this docs and checked against the API's validation; ids in angle brackets are placeholders. Response values are placeholders built from the schema.