# Editing attendees

### Editing regular fields

To edit attendee details, such as first name, last name, job title and more, you must use the `event.person.operate` endpoint operation. To access this API, you must have in hands an access token with full Event Environment (or Company Environment) permission on **System scope** or the attendee's own access token.

#### Keys allowed

```json
{
    "name": "attendee full name",
    "firstName": "attendee first name",
    "lastName": "attendee last name",
    "email": "attendee email",
    "password": "attendee password",
    "role": "attendee job title",
    "company": "attendee company name",
    "summary": "attendee bio",
    "image": "attendee profile picture (url)",
    "telephone": "attendee telephone",
    "city": "attendee city",
    "facebook": "attendee facebook profile (url)",
    "linkedin": "attendee linkedin profile (url)",
    "twitter": "attendee twitter profile (url)",
    "instagram": "attendee instagram profile (url)",
    "website": "attendee website (url)",
    "message": "attendee itinerary message (only admin access token)",
    "language": "attendee preferred language (ISO 639-1 format)",
    "private": "attendee profile privacy (0 or 1)",
    "rsvp": "attendee rsvp status (0 or 1)",
    "present": "attendee attendance status (0 or 1)",
    "level": "attendee permission level (numeric)",
    "nfc": "attendee nfc base64 tag",
    "ticketID": "attendee ticket in use (only admin access token)",
    "profileID": "attendee custom permission profile (only admin access token)",
    "assistantEmail": "the assistant email this attendee will get emails from (only admin access token)",
    "tagIDs": "attendee tags (separated by comma)"
}
```

If you are using an admin access token with **System scope** and Event Environment (or Company Environment) full access, you must provide the `personID` query attribute in the request, otherwise you will edit your own user credentials (as long as you are an attendee).

#### Operation modes

You can either operate on attendee fields using one field at a time (one update per request) or several fields at the same time. To update one field at a time, you must provide the field key on the `key` query attribute and its value on the `value` body attribute. To update several fields at a time, you must provide a `content` body attribute with an Array of Objects `{key:value}` as demonstrated below:

```json
[
    {"key": "firstName", "value": "Mauricio"},
    {"key": "lastName", "value": "Giordano"}
]
```

#### Example

This endpoint allows you to edit the attendee regular fields and it expects the following query attributes: `tokenID`, `eventID`, `personID` and `key` and the following body attribute: `value`. Please see the example below.

```sh
curl --request POST \
     --url 'https://api.inevent.com/?action=event.person.operate&tokenID=YOUR_TOKEN_HERE&eventID=YOUR_EVENT_ID&key=firstName&personID=PERSON_ID' \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --data value=NewName!
```

#### Response

```json
{
  "count": 1,
  "data": [
    {
      "username": "example@email.com",
      "facebookID": "",
      "linkedInID": "",
      "twitterID": "",
      "email": "example@email.com",
      "telephone": "+1 999-999-9999",
      "qrCode": "7d288b89132c2623411306de5eb8150c7f152f1b7e96e094df6ddf35d12c6f37",
      "ebQrCode": "",
      "nfc": "",
      "eventID": "5",
      "personID": "1",
      "firstName": "NewName",
      "lastName": "Giordano",
      "name": "NewName Giordano",
      "personName": "NewName Giordano",
      "role": "CTO",
      "company": "InEvent",
      "summary": "",
      "image": "https://cdn.inevent.com/1/0/c98558f90829a4c99569808e255c682f6874ac72.png",
      "headline": "CTO @ InEvent",
      "personHeadline": "CTO @ InEvent",
      "city": "",
      "facebook": "",
      "linkedIn": "",
      "twitter": "",
      "instagram": "",
      "website": "",
      "position": "34",
      "level": "4",
      "ebUserID": "",
      "mkUserID": "0",
      "approved": "1",
      "paid": "0",
      "rsvp": "-1",
      "present": "1",
      "message": "",
      "private": "0",
      "meetingQuotaID": "0",
      "meetingAutoConfirm": "1",
      "engagement": "0",
      "language": "en",
      "personLanguage": "en",
      "origin": "panel",
      "salesforceID": "003f40000150VhbAAE",
      "salesforceType": "Contact",
      "hubspotID": "",
      "enrollmentDate": "1626126916",
      "updatedDate": "1634693525",
      "meetingQuotaName": "",
      "meetingQuotaAmount": "0",
      "device": "none",
      "downloaded": "0",
      "favorite": "0",
      "ally": "0",
      "isSponsor": "1",
      "prints": "0",
      "profileID": "",
      "ticketID": "3",
      "assistantEmail": "",
      "ticketName": "Ticket 125",
      "ticketEntrance": "",
      "tags": [
        {
          "tagID": "50",
          "eventID": "5",
          "name": "Artificial Intelligence",
          "color": "#9F0F4F",
          "type": "person"
        },
        {
          "tagID": "4",
          "eventID": "5",
          "name": "Machine Learning",
          "color": "#FF0000",
          "type": "person"
        }
      ],
      "speakerID": ""
    }
  ]
}
```

### Editing custom fields

To edit custom fields, you must use the endpoint `feedback.respond`. You must provide the `tokenID` and `eventID` query attributes, the `personID` query attribute in case you are an admin with Event Environment (or Company Environment) access on **System scope** access token trying to edit a specific attendee of the event, and the `content` body attribute.

The `content` body attribute consists of either an Array of Objects `[{feedbackID, value}]` or an Object `{feedbackKey:value}` (in case you have the `API Field` set for your custom fields).

Here is an example using the Array of Objects option:

```json
[
  { "feedbackID": "1", "value": "A" },
  { "feedbackID": "2", "value": "B" },
  { "feedbackID": "3", "value": "C" }
]
```

Here is an example using the Object option (`API Field` enabled):

```json
{
  "f_field_1": "A",
  "f_field_2": "B",
  "f_field_3": "C"
}
```

The advantage of using the `API Field` option is when you copy your event or when you create a template, the API call will be the exact same, whereas the `feedbackID` option will change the IDs.

#### Example

This endpoint allows you to edit the attendee custom fields and it expects the following query attributes: `tokenID`, `eventID`, `personID` and the following body attribute: `content`. Please see the example below.

```sh
curl --request POST \
     --url 'https://api.inevent.com/?action=feedback.respond&tokenID=YOUR_TOKEN_HERE&eventID=YOUR_EVENT_ID&personID=PERSON_ID' \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --data content={"f_field_1":"A","f_field_2":"B"}
```

#### Response

```json
{
  "count": 0,
  "data": []
}
```

The response is always empty for this request.
