User Create or Update

Description

The UserCreateUpdate operation allows you to create or update a user record. If a UserOGFN is included as part of the UserWS aggregate, then an attempt will be made to update an existing record. If the UserOGFN is not included, an attempt will be made to create a new User record if the username is not already taken. If in this case the username is already taken, then an error will be returned.

Version

2011-02-02

URI

REST URI [POST]:
/v11.02/User.svc/CreateUpdate?SessionId={SessionId}

Content-Type: Application/xml

Example

Request POST
http://wsdev.onegreatfamily.com/v11.02/User.svc/CreateUpdate?SessionId=gl4q23cwofpshi55sg1dvc3o
Request Headers
Content-Type: Application/xml
Request Payload
<UserWS xmlns="http://schemas.datacontract.org/2004/07/OGF.WS.Data">
	<AccountId>0</AccountId>
	<Address1>Address1</Address1>
	<Address2>Address2</Address2>
	<City>Springville</City>
	<Country>USA</Country>
	<Email>test@onegreatfamily.com</Email>
	<FirstName>First Name</FirstName>
	<GroupOgfns xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
		<a:unsignedLong>5</a:unsignedLong>
		<a:unsignedLong>6</a:unsignedLong>
	</GroupOgfns>
	<LastName>Surname</LastName>
	<Ogfn>0</Ogfn>
	<Password>wsuser-1947946234</Password>
	<State>Utah</State>
	<SubscriptionType>NONE</SubscriptionType>
	<UserType>NONE</UserType>
	<Username>wsuser-1947946234</Username>
	<Zip>84663</Zip>
</UserWS> 
Success Response Payload
<UserWS xmlns="http://schemas.datacontract.org/2004/07/OGF.WS.Data">
	<AccountId>0</AccountId>
	<Address1>Address1</Address1>
	<Address2>Address2</Address2>
	<City>Springville</City>
	<Country>USA</Country>
	<Email>test@onegreatfamily.com</Email>
	<FirstName>First Name</FirstName>
	<GroupOgfns xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
		<a:unsignedLong>5</a:unsignedLong>
		<a:unsignedLong>6</a:unsignedLong>
	</GroupOgfns>
	<LastName>Surname</LastName>
	<Ogfn>1854111</Ogfn>
	<Password>wsuser-1947946234</Password>
	<State>Utah</State>
	<SubscriptionType>NONE</SubscriptionType>
	<UserType>NONE</UserType>
	<Username>wsuser-1947946234</Username>
	<Zip>84663</Zip>
</UserWS>
Fault Response Payload
<RestFault xmlns="http://schemas.datacontract.org/2004/07/OGF.WS.Data">
	<ErrorCode>551</ErrorCode>
	<FaultMessage>An unhandled exception has occurred</FaultMessage>
</RestFault>

Query String Parameters

Name Description Required

SessionId

The current session Id

Type: string

Default: None

Yes

POST Payload

Name Description Required

User

The User record to be updated or created

Type: UserWS aggregate

Default: None

Constraints: Must be a valid aggregate.

Yes

Response Elements

The only thing returned is the aggregate below:

Name Description

User

This operation returns a UserWS aggregate upon success. If an update was attempted, it will be the same aggreate passed, if a create was attempted it will include the newly created UserOGFN

Type: UserWS

HTTP Status Code

The Web Server returns a status code which indicates if the operation was successful. Anything other than 200 should be regarded as a failure.

HTTP Status Code of 417

The Web Server threw an exception and contains a RestFault aggregate. Retrieve the RestFault from the Webexception response property.