Modify a Person

We are going to modify a person, in this case your account specifically, in two ways. The first is by adding a new address to it and the second is by making you a super hero, in name. When adding an address to a person there is no need to update the person afterwards as the address add method automatically appends the address into the person object. However when modifying the person object like we are with the common name you must call the UpdatePerson method otherwise nothing will be changed.

For more information on People, Addresses, and the methods used please look at PersonInfo and AddressInfo.

Example in C#

var user = await client.GetCurrentUserAsync();//We are going to modify your account
var person = await client.GetPersonByUserAsync(user); //there are many ways to find a person this is just easy
//now we have you as a person lets add an address
var address = await client.AddAddressAsync(person, 
new PhoneInfo
    {
        Type="Work",
        Number ="613-555-2222"
    });
//lets try changing your common name
person.CommonName = "The Flash";
await client.UpdatePersonAsync(person);

Example in CURL

#Get User
curl -X GET \
    https://keepapi.feenicshosting.com/api/currentuser \
    -H 'Authorization:  Bearer TOKEN_GOES_HERE' \
    -H 'Content-Type: application/json'

#Get Person
curl -X GET \
    https://keepapi.feenicshosting.com/api/f/INSTANCE.KEY/users/USER.KEY/person \
    -H 'Authorization:  Bearer TOKEN_GOES_HERE' \
    -H 'Content-Type: application/json' 

#Add Address
curl -X POST \
    https://keepapi.feenicshosting.com/api/f/INSTANCE.KEY/people/PERSON.KEY/addresses \
    -H 'Authorization:  Bearer TOKEN_GOES_HERE' \
    -H 'Content-Type: application/json' \
    -d '{"$type":"Feenics.Keep.WebApi.Model.PhoneInfo, Feenics.Keep.WebApi.Model","Number":"613-555-2222","Key":null,"IsPrivate":false,"Type":"Work","Href":null}'

#Change Common Name
curl -X PUT \
    https://keepapi.feenicshosting.com/api/f/INSTANCE.KEY/people/PERSON.KEY \
    -H 'Authorization: Bearer TOKEN_GOES_HERE' \
    -H 'Content-Type: application/json' \
    -D '{
            "$type":"Feenics.Keep.WebApi.Model.PersonInfo, Feenics.Keep.WebApi.Model",
            "GivenName":"ExamplePerson",
            "Surname":"For_cUrl",
            "Addresses":[],
            "CardAssignments":[],
            "Key":"PERSON.KEY",
            "CommonName":"The Flash",
            "InFolderHref":"/api/f/INSTANCE.KEY",
            "InFolderKey":"INSTANCE.KEY",
            "Links":
            [
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"Addresses",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"addresses",
                        "Text":"Addresses"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"User",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"user",
                        "Text":"User"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"AccessLevels",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"accesslevels",
                        "Text":"Access Levels"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"Cards",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"cards",
                        "Text":"Card Assignments"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"Visiting",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"visiting",
                        "Text":"Visiting"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"Visitors",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"visitors",
                        "Text":"Visitors"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"CompareImage",
                    "Anchor":
                    {   
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"compareimage",
                        "Text":"Compare Image"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"Meta",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"meta",
                        "Text":"Metadata"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"Monikers",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"monikers",
                        "Text":"Monikers"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"CommonName",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"commonname",
                        "Text":"Common Name"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"Images",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"images",
                        "Text":"Images"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"TakeOwnership",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"takeownership",
                        "Text":"Take Ownership"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"Connections",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"connections",
                        "Text":"Connected Objects"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"References",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"references",
                        "Text":"Referencing Objects"
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.Link, Feenics.Keep.WebApi.Model",
                    "Relation":"Notes",
                    "Anchor":
                    {
                        "$type":"Feenics.Keep.WebApi.Model.Anchor, Feenics.Keep.WebApi.Model",
                        "Href":"notes",
                        "Text":"Notes"
                    }
                }
            ],
            "ObjectLinks":
            [
                {
                    "$type":"Feenics.Keep.WebApi.Model.ObjectLinkItem, Feenics.Keep.WebApi.Model",
                    "Href":null,
                    "LinkedObjectKey":"INSTANCE.KEY",
                    "CommonName":"INSTANCE_NAME",
                    "Relation":"InInstance",
                    "MetaDataBson":
                    {
                        "$type":"System.Byte[], mscorlib",
                        "$value":""
                    }
                },
                {
                    "$type":"Feenics.Keep.WebApi.Model.ObjectLinkItem, Feenics.Keep.WebApi.Model",
                    "Href":null,
                    "LinkedObjectKey":"INSTANCE.KEY",
                    "CommonName":"INSTANCE_NAME",
                    "Relation":"InstanceScope",
                    "MetaDataBson":
                    {
                        "$type":"System.Byte[], mscorlib",
                        "$value":""
                    }
                }
            ],
            "Metadata":[],
            "Notes":[],
            "Tags":[],
            "Monikers":[],
            "Href":"/api/f/INSTANCE.KEY/people/PERSON.KEY"
        }'