Difference between revisions of "Adding or Updating Members"
(Created page with "__NOTOC__The process of creating a member in Fishbowl database is as follows: Find out if a specific email address already exists in the site. Send a GET request to the Mem...") |
|||
Line 1: | Line 1: | ||
− | + | __NOTOC__ | |
+ | The process of creating a member in Fishbowl database is as follows: | ||
+ | <br/>Find out if a specific email address already exists in the site. Send a GET request to the Members endpoint and include the email address in the $filter query string parameter. | ||
− | |||
==== Example: ==== | ==== Example: ==== | ||
− | + | GET [http://enterprise.qa.fishbowl.com/api/odata/v1/SITE_ID/Members http://services.fishbowl.com/api/odata/v1/SITE_ID/Members]? | |
− | GET http://enterprise.qa.fishbowl.com/api/odata/v1/SITE_ID/Members? | + | $filter=EmailAddress%20eq%20'johndoe@test.com' HTTP/1.1 |
− | + | Accept: application/json | |
− | + | Authorization: Bearer u7kBYz1UhHkoRSc7V4gruBs-4sEpIkFV-F4LGiFMwfGwJNnT_JzNft | |
− | + | g6_Zm0yWi8P m60iPlmCCHUSwCX5Uru-OJq2jzhbT-E6nAc1OwzghTCmeoo0K69ubDBMFX5hyKlc | |
− | + | AjA9H3Vs-ZNjNYKarpSO5rA5ubG5-Va5Aigm9mp-Pre-EaGAY_HBdxZi-LBMSQ_mSjyIDPBpLFYP | |
− | + | BNzK3cu0xGobGsFLxPtDG3urs_4abXZtvxN8wm9rpsgr | |
− | + | ||
Line 21: | Line 21: | ||
− | + | ||
{ | { | ||
− | + | "odata.metadata":"[http://enterprise.qa.fishbowl.com/API/odata/v1/2147483947/ http://services.fishbowl.com/API/odata/v1/2147483947/] | |
− | + | $metadata#Members", | |
− | + | "value":[] | |
− | + | } | |
− | If this is the case, a new member can be created by sending a POST request to the Members endpoint. | + | If this is the case, a new member can be created by sending a POST request to the Members endpoint. Note: if you try to create member with an email address that already exists, a 409 error (Conflict) will be returned. |
− | Note: if you try to create member with an email address that already exists, a 409 error (Conflict) will be returned. | + | |
− | ==== Example: ==== | + | ==== Example: ==== |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | POST [http://enterprise.qa.fishbowl.com/api/odata/v1/SITE_ID/Members http://services.fishbowl.com/api/odata/v1/SITE_ID/Members] HTTP/1.1 | ||
+ | Accept: application/json | ||
+ | Authorization: Bearer u7kBYz1UhHkoRSc7V4gruBs-4sEpIkFV-F4LGiFMwfGwJNnT_JzNft | ||
+ | g6_Zm0yWi8P m60iPlmCCHUSwCX5Uru-OJq2jzhbT-E6nAc1OwzghTCmeoo0K69ubDBMFX5hyKlc | ||
+ | AjA9H3Vs-ZNjNYKarpSO5rA5ubG5-Va5Aigm9mp-Pre-EaGAY_HBdxZi-LBMSQ_mSjyIDPBpLFYP | ||
+ | BNzK3cu0xGobGsFLxPtDG3urs_4abXZtvxN8wm9rpsgr | ||
+ | Content-Type: application/json; charset=utf-8 | ||
+ | { | ||
+ | "SiteID":"2147483947", | ||
+ | "EmailAddress":"johndoe@test.com", | ||
+ | "SubscriptionsForMember":[ | ||
+ | { | ||
+ | "ListID":"2147484225", | ||
+ | "IsSubscribed":true | ||
+ | }, | ||
+ | { | ||
+ | "ListID":"2147485177", | ||
+ | "IsSubscribed":true | ||
+ | } | ||
+ | ], | ||
+ | "StringFields":[ | ||
+ | { | ||
+ | "Name":"FirstName", | ||
+ | "Value":"John" | ||
+ | }, | ||
+ | { | ||
+ | "Name":"LastName", | ||
+ | "Value":"Doe" | ||
+ | }, | ||
+ | { | ||
+ | "Name":"StoreCode", | ||
+ | "Value":"001" | ||
+ | }, | ||
+ | { | ||
+ | "Name":"InputSource", | ||
+ | "Value":"Partner" | ||
+ | } | ||
+ | ], | ||
+ | "DateFields":[ | ||
+ | { | ||
+ | "Name":"Birthdate", | ||
+ | "Value":"1999-04-03T00:00:00" | ||
+ | }, | ||
+ | { | ||
+ | "Name":"Anniversary", | ||
+ | "Value":null | ||
+ | }, | ||
+ | { | ||
+ | "Name":"JoinDate", | ||
+ | "Value":"2014-12-04T00:00:00" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | |||
− | If the response contains member data, member already exists. | + | <br/>If the response contains member data, member already exists. |
{ | { | ||
− | + | "odata.metadata":"[http://enterprise.qa.fishbowl.com/API/odata/v1/2147483947/ http://services.fishbowl.com/API/odata/v1/2147483947/] | |
− | + | $metadata#Members", | |
− | + | "value":[ | |
− | + | { | |
− | + | "MemberID":"2148166490", | |
− | + | "SiteID":"2147483947", | |
− | + | "EmailAddress":"johndoe@test.com", | |
− | + | "HardBounces":0, | |
− | + | "SoftBounces":0, | |
− | + | "Suppressed":false, | |
− | + | "IsTester":false, | |
− | + | "CreatedUtc":"2014-11-07T17:13:23.88Z", | |
− | + | "LastUpdatedUtc":"0001-01-01T05:00:00Z", | |
− | + | "StringFields":[ | |
− | + | { | |
− | + | "Name":"FirstName", | |
− | + | "Value":"John" | |
− | + | }, | |
− | + | { | |
− | + | "Name":"LastName", | |
− | + | "Value":"Doe" | |
− | + | }, | |
− | + | { | |
− | + | "Name":"StoreCode", | |
− | + | "Value":"001" | |
− | + | }, | |
− | + | { | |
− | + | "Name":"InputSource", | |
− | + | "Value":"Partner" | |
− | + | } | |
− | + | ], | |
− | + | "BooleanFields":[], | |
− | + | "Int32Fields":[], | |
− | + | "Int64Fields":[], | |
− | + | "DateFields":[ | |
− | + | { | |
− | + | "Name":"Birthdate", | |
− | + | "Value":"1999-04-03T00:00:00" | |
− | + | }, | |
− | + | { | |
− | + | "Name":"Anniversary", | |
− | + | "Value":null | |
− | + | }, | |
− | + | { | |
− | + | "Name":"JoinDate", | |
− | + | "Value":"2014-12-04T00:00:00.000" | |
− | + | } | |
− | + | ], | |
− | + | "DecimalFields":[], | |
− | + | "Subscriptions":[ | |
− | + | { | |
− | + | "ListID":"2147484225", | |
− | + | "IsSubscribed":true | |
− | + | }, | |
− | + | { | |
− | + | "ListID":"2147485177", | |
− | + | "IsSubscribed":true | |
− | + | } | |
− | + | ], | |
− | + | "MemberTags":[] | |
− | + | } | |
− | + | ] | |
− | + | } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | <br/>To update the member record and/or subscribe the member to additional list(s), send a PATCH or MERGE request to the Members endpoint and include the member ID as parameter (Member ID can be obtained from the response). | ||
− | The request URL will have the following format: http://enterprise.qa.fishbowl.com/API/odata/v1/SITE_ID/Members(MEMBER_IDL) | + | <br/>The request URL will have the following format: [http://enterprise.qa.fishbowl.com/API/odata/v1/SITE_ID/Members(MEMBER_IDL) http://services.fishbowl.com/API/odata/v1/SITE_ID/Members(MEMBER_IDL)] Note the L following the MemberID, which is used to indicate 64-bit integer, e.g.: (2148166490L) |
− | Note the L following the MemberID, which is used to indicate 64-bit integer, e.g.: (2148166490L) | + | |
Line 174: | Line 169: | ||
==== Example: ==== | ==== Example: ==== | ||
− | + | MERGE [http://enterprise.qa.fishbowl.com/API/odata/v1/SITE_ID/Members(MEMBER_IDL) http://services.fishbowl.com/API/odata/v1/SITE_ID/Members(MEMBER_IDL)] | |
− | MERGE http://enterprise.qa.fishbowl.com/API/odata/v1/SITE_ID/Members(MEMBER_IDL) | + | HTTP/1.1 |
− | + | Accept: application/json | |
− | + | Authorization: Bearer u7kBYz1UhHkoRSc7V4gruBs-4sEpIkFV-F4LGiFMwfGwJNnT_JzNft | |
− | + | g6_Zm0yWi8P m60iPlmCCHUSwCX5Uru-OJq2jzhbT-E6nAc1OwzghTCmeoo0K69ubDBMFX5hyKlc | |
− | + | AjA9H3Vs-ZNjNYKarpSO5rA5ubG5-Va5Aigm9mp-Pre-EaGAY_HBdxZi-LBMSQ_mSjyIDPBpLFYP | |
− | + | BNzK3cu0xGobGsFLxPtDG3urs_4abXZtvxN8wm9rpsgr | |
− | + | Content-Type: application/json; charset=utf-8 | |
− | + | { | |
− | + | "SiteID":"2147483947", | |
− | + | "MemberID":"2148166490", | |
− | + | "EmailAddress":"johndoe@test.com", | |
− | + | "SubscriptionsForMember":[ | |
− | + | { | |
− | + | "ListID":"2147484226", | |
− | + | "IsSubscribed":true | |
− | + | } | |
− | + | ], | |
− | + | "StringFields":[ | |
− | + | { | |
− | + | "Name":"FirstName", | |
− | + | "Value":"John" | |
− | + | }, | |
− | + | { | |
− | + | "Name":"LastName", | |
− | + | "Value":"Doe" | |
− | + | }, | |
− | + | { | |
− | + | "Name":"StoreCode", | |
− | + | "Value":"001" | |
− | + | } | |
− | + | ], | |
− | + | "DateFields":[ | |
− | + | { | |
− | + | "Name":"Birthdate", | |
− | + | "Value":"1999-04-03T00:00:00" | |
− | + | }, | |
− | + | { | |
− | + | "Name":"Anniversary", | |
− | + | "Value":"2009-02-14T00:00:00" | |
− | + | } | |
− | + | ] | |
− | + | } | |
− | + |
Revision as of 08:43, 14 May 2015
The process of creating a member in Fishbowl database is as follows:
Find out if a specific email address already exists in the site. Send a GET request to the Members endpoint and include the email address in the $filter query string parameter.
Example:
GET http://services.fishbowl.com/api/odata/v1/SITE_ID/Members? $filter=EmailAddress%20eq%20'johndoe@test.com' HTTP/1.1 Accept: application/json Authorization: Bearer u7kBYz1UhHkoRSc7V4gruBs-4sEpIkFV-F4LGiFMwfGwJNnT_JzNft g6_Zm0yWi8P m60iPlmCCHUSwCX5Uru-OJq2jzhbT-E6nAc1OwzghTCmeoo0K69ubDBMFX5hyKlc AjA9H3Vs-ZNjNYKarpSO5rA5ubG5-Va5Aigm9mp-Pre-EaGAY_HBdxZi-LBMSQ_mSjyIDPBpLFYP BNzK3cu0xGobGsFLxPtDG3urs_4abXZtvxN8wm9rpsgr
If the response’s value field is empty, that means the member with that email address does not exist.
{ "odata.metadata":"http://services.fishbowl.com/API/odata/v1/2147483947/ $metadata#Members", "value":[] }
If this is the case, a new member can be created by sending a POST request to the Members endpoint. Note: if you try to create member with an email address that already exists, a 409 error (Conflict) will be returned.
Example:
POST http://services.fishbowl.com/api/odata/v1/SITE_ID/Members HTTP/1.1 Accept: application/json Authorization: Bearer u7kBYz1UhHkoRSc7V4gruBs-4sEpIkFV-F4LGiFMwfGwJNnT_JzNft g6_Zm0yWi8P m60iPlmCCHUSwCX5Uru-OJq2jzhbT-E6nAc1OwzghTCmeoo0K69ubDBMFX5hyKlc AjA9H3Vs-ZNjNYKarpSO5rA5ubG5-Va5Aigm9mp-Pre-EaGAY_HBdxZi-LBMSQ_mSjyIDPBpLFYP BNzK3cu0xGobGsFLxPtDG3urs_4abXZtvxN8wm9rpsgr Content-Type: application/json; charset=utf-8 { "SiteID":"2147483947", "EmailAddress":"johndoe@test.com", "SubscriptionsForMember":[ { "ListID":"2147484225", "IsSubscribed":true }, { "ListID":"2147485177", "IsSubscribed":true } ], "StringFields":[ { "Name":"FirstName", "Value":"John" }, { "Name":"LastName", "Value":"Doe" }, { "Name":"StoreCode", "Value":"001" }, { "Name":"InputSource", "Value":"Partner" } ], "DateFields":[ { "Name":"Birthdate", "Value":"1999-04-03T00:00:00" }, { "Name":"Anniversary", "Value":null }, { "Name":"JoinDate", "Value":"2014-12-04T00:00:00" } ] }
If the response contains member data, member already exists.
{ "odata.metadata":"http://services.fishbowl.com/API/odata/v1/2147483947/ $metadata#Members", "value":[ { "MemberID":"2148166490", "SiteID":"2147483947", "EmailAddress":"johndoe@test.com", "HardBounces":0, "SoftBounces":0, "Suppressed":false, "IsTester":false, "CreatedUtc":"2014-11-07T17:13:23.88Z", "LastUpdatedUtc":"0001-01-01T05:00:00Z", "StringFields":[ { "Name":"FirstName", "Value":"John" }, { "Name":"LastName", "Value":"Doe" }, { "Name":"StoreCode", "Value":"001" }, { "Name":"InputSource", "Value":"Partner" } ], "BooleanFields":[], "Int32Fields":[], "Int64Fields":[], "DateFields":[ { "Name":"Birthdate", "Value":"1999-04-03T00:00:00" }, { "Name":"Anniversary", "Value":null }, { "Name":"JoinDate", "Value":"2014-12-04T00:00:00.000" } ], "DecimalFields":[], "Subscriptions":[ { "ListID":"2147484225", "IsSubscribed":true }, { "ListID":"2147485177", "IsSubscribed":true } ], "MemberTags":[] } ] }
To update the member record and/or subscribe the member to additional list(s), send a PATCH or MERGE request to the Members endpoint and include the member ID as parameter (Member ID can be obtained from the response).
The request URL will have the following format: http://services.fishbowl.com/API/odata/v1/SITE_ID/Members(MEMBER_IDL) Note the L following the MemberID, which is used to indicate 64-bit integer, e.g.: (2148166490L)
Example:
MERGE http://services.fishbowl.com/API/odata/v1/SITE_ID/Members(MEMBER_IDL) HTTP/1.1 Accept: application/json Authorization: Bearer u7kBYz1UhHkoRSc7V4gruBs-4sEpIkFV-F4LGiFMwfGwJNnT_JzNft g6_Zm0yWi8P m60iPlmCCHUSwCX5Uru-OJq2jzhbT-E6nAc1OwzghTCmeoo0K69ubDBMFX5hyKlc AjA9H3Vs-ZNjNYKarpSO5rA5ubG5-Va5Aigm9mp-Pre-EaGAY_HBdxZi-LBMSQ_mSjyIDPBpLFYP BNzK3cu0xGobGsFLxPtDG3urs_4abXZtvxN8wm9rpsgr Content-Type: application/json; charset=utf-8 { "SiteID":"2147483947", "MemberID":"2148166490", "EmailAddress":"johndoe@test.com", "SubscriptionsForMember":[ { "ListID":"2147484226", "IsSubscribed":true } ], "StringFields":[ { "Name":"FirstName", "Value":"John" }, { "Name":"LastName", "Value":"Doe" }, { "Name":"StoreCode", "Value":"001" } ], "DateFields":[ { "Name":"Birthdate", "Value":"1999-04-03T00:00:00" }, { "Name":"Anniversary", "Value":"2009-02-14T00:00:00" } ] }