Remove email and phone number from customer in Kustomer - api

I'm having trouble deleting the emails and phones keys from customers.
When I have to re-create a customer, I get an error message because the first record has the same phone and email address. I tried simply removing them from the old record but it gives me a 400 bad request. It says I need to specify an email and phone.
This wouldn't be surprising, especially since the documentation specifies that they are required fields. What's strange is that I can create customers without emails and phones just fine. It's just that once they have them, I can't get rid of them. Is there some workaround that would allow me to re-create a customer?

The way to currently remove an email or phone number from a customer is to update the customer object with the emails you want to keep.
For an example, if you have a customer object that looks like:
{
"data": {
"type": "customer",
"id": "58863fe94aa1701100efcb1d",
"attributes": {
"name": "Joe Cornelius Schmoe III",
"displayName": "Joe Cornelius Schmoe III",
"displayColor": "teal",
"displayIcon": "broom",
"externalId": "user-3",
"externalIds": [
{
"externalId": "user-3",
"verified": true
}
],
"firstName": "Joe",
"lastName": "Schmoe",
"sharedExternalIds": [],
"emails": [
{
"email": "test#gmail.com",
"verified": false,
"type": "home"
},
{
"email": "test2#gmail.com",
"verified": false,
"type": "home"
}
],
....
}
In cases where you would like to remove the email associated with home (works the same way for phones array.)
PUT /v1/customers/{customerId}
{
"emails": [
{
"email": "test#gmail.com",
"verified": false,
"type": "home"
}
]
}
The customer record will now be updated to only include the specified email.
{
"data": {
"type": "customer",
"id": "58863fe94aa1701100efcb1d",
"attributes": {
"name": "Joe Cornelius Schmoe III",
"displayName": "Joe Cornelius Schmoe III",
"displayColor": "teal",
"displayIcon": "broom",
"externalId": "user-3",
"externalIds": [
{
"externalId": "user-3",
"verified": true,
"id": null
}
],
"firstName": "Joe",
"lastName": "Schmoe",
"sharedExternalIds": [],
"emails": [
{
"email": "test#gmail.com",
"verified": false,
"type": "home",
"id": null
}
]
.....
}

Related

Import API webhooks not triggered

When I use the import API (/api/user/import) the webhooks are not triggerd.
I tested this using postman, the /api/user/registration endpoint is working.
This is the postman request resulting in no webhooks fired and 200OK:
"users": [
{
"active": true,
"birthDate": "1976-05-30",
"data": {
"displayName": "Jan"
},
"email": "jan#fusionauth.io",
"encryptionScheme": "salted-md5",
"factor": 1000,
"password": "5ac152b6f8bdb8bb12959248d542cb237c4a730064bf88bbb8dd6e204912baad",
"expiry": 1571786483322,
"firstName": "Jan",
"fullName": "Jan",
"insertInstant": 1331449200000,
"lastName": "Boos",
"middleName": "Kleine kinderen",
"mobilePhone": "303-555-1234",
"passwordChangeRequired": false,
"preferredLanguages": [
"en",
"fr"
],
"registrations": [
{
"applicationId": "7a61c6e9-b1bb-44c0-8532-07af1b04674a",
"data": {
"birthplace": "Amsterdam"
},
"insertInstant": 1331449200000,
"preferredLanguages": [
"de"
],
"username": "Jan",
"verified": true
}
],
"salt": "NDdiYWZkZDMtYjk5ZC00ZmZkLWE1YmUtZTQxNGM4MDkwNWYw",
"timezone": "America/Denver",
"twoFactorEnabled": false,
"usernameStatus": "ACTIVE",
"username": "Jan",
"verified": true
}
]
}
Any suggestions?
It was a RTFM issue:
We selected our application on the Applications tab under webhooks settings.
We did not know selecting an application will limit you to only receiving application events.
You can still enable the events even if the are not fired, this is confusing from UX standpoints.
Solution: Selecting "All applications" in the configuration.

How to generate HTML table for test execution summary in Email (Outlook) body

Background:
In our project[selenium-cucumber-java-Mvn based] we have test execution reporting done through- master thoughts Cucumber report (mvn dependency). This Report get generated in the test>target directory and we are sharing this folders Link embed in an email to everyone automatically for reporting. Here recipient has to open this link to see the status. Link looks like-
http://localhost:63342/Automation/TestExecutionReports/02-08-2018/Run-1/cucumber-html-reports/overview-features.html
Question:
Now we have a need to send Execution summary also in the email so that one can see high level status without even drilling through Link.
So we need to insert a Tabular format- with columns -TC Name, Status, Execution Time, Overall Count etc. in email body itself in addition to the above Link.
Can someone plz help me doing this?
Other info:
I don't know much how internally master though works, but it gathers the execution data via a JSON file. And we are generating this report in the onExecutionfinish method of TestNGExecutionListener.
our current report looks like an attached snap.
Our json is contains the following info-
[
{
"line": 1,
"elements": [
{
"before": [
{
"result": {
"duration": 3849355155,
"status": "passed"
},
"match": {
"location": "CucumberHooks.InitBrowser()"
}
}
],
"line": 3,
"name": "Add Account and verify details",
"description": "",
"id": "add-account-and-verify-details;add-account-and-verify-details",
"after": [
{
"result": {
"duration": 129904,
"status": "passed"
},
"match": {
"location": "CucumberHooks.TearDownTest(Scenario)"
}
}
],
"type": "scenario",
"keyword": "Scenario",
"steps": [
{
"result": {
"duration": 13810592966,
"status": "passed"
},
"line": 5,
"name": "I have Logged in to Grid application",
"match": {
"location": "leaseSearchSteps.i_have_Logged_in_to_Grid_application()"
},
"keyword": "Given "
},
{
"result": {
"duration": 4659413417,
"status": "passed"
},
"line": 6,
"name": "I select Accounts and Contacts option from the Homepage",
"match": {
"location": "createAccountSteps.selectAccountsAndContactsOptionFromTheHomepage()"
},
"keyword": "And "
},
{
"result": {
"duration": 3470670155,
"status": "passed"
},
"line": 7,
"name": "Click on Add Account button",
"match": {
"location": "createAccountSteps.clickOnAddAccountButton()"
},
"keyword": "Then "
},
{
"result": {
"duration": 28732919407,
"status": "passed"
},
"line": 8,
"name": "Create Account with Account name as \"Pacific UAT Test Account\"",
"match": {
"arguments": [
{
"val": "Pacific UAT Test Account",
"offset": 37
}
],
"location": "createAccountSteps.createAccountWithAccountName(String)"
},
"keyword": "Then "
},
{
"result": {
"duration": 2243415294,
"status": "passed"
},
"line": 9,
"name": "Click on View button",
"match": {
"location": "createAccountSteps.clickOnViewButton()"
},
"keyword": "Then "
},
{
"result": {
"duration": 121318771,
"status": "passed"
},
"line": 10,
"name": "Verify the newly created Account name",
"match": {
"location": "createAccountSteps.verifyTheNewlyCreatedAccountName()"
},
"keyword": "Then "
}
],
"tags": [
{
"line": 2,
"name": "#Test"
}
]
}
],
"name": "Add Account and verify details",
"description": "",
"id": "add-account-and-verify-details",
"keyword": "Feature",
"uri": "src/test/resources/cucumber/featureFiles/AU/addAccountAndVerify.feature"
}
]
I dont have code but I think a probable approach can be like below-
First write some code to generate Table Template with its Header, Main Table, Rows and Columns and Footer.
Then insert the Data into this table by reading it from the features.html page you have (as mentioned in url ). You should be able to read data for pass, fail or whatever needed from this html web page through standard methods [like- getText()] of Selenium .
In the end get this whole table appended to a StringBuilder and send in email message as bu using setting content of thmlSourceEmbed as text/html..hope this help

eBay API issues - cannot publish an offer

All of the following is being performed in eBay's API sandbox.
I am attempting to list an item by using the inventory API. Specifically, I have created an inventory item and a relevant offer for that item. When I make a POST request to the publish offer endpoint, I get the following error:
{
"errors": [
{
"errorId": 25016,
"domain": "API_INVENTORY",
"subdomain": "Selling",
"category": "REQUEST",
"message": "The title value is invalid. Seller Provided Title Value is missing."
},
{
"errorId": 25002,
"domain": "API_INVENTORY",
"subdomain": "Selling",
"category": "REQUEST",
"message": "A user error has occurred. The duration \"GTC\" day(s) is not available for this listing type, or invalid for category \"49996\".",
"parameters": [
{
"name": "0",
"value": "GTC"
},
{
"name": "1",
"value": "49996"
}
]
}
]
}
I can't see any reference in any of the API documentation to a "Seller Provided Title". The duration error is also confusing as the API says it only supports "GTC" listings. The product has a title so it must be in reference to something else.
My inventory item is as follows:
{
"sku": "13725",
"product": {
"title": "Harley Davidson bike",
"aspects": {
"Year": [
"2016"
],
"Model": [
"Road Glide Special"
],
"Manufacurer": [
"Harley-Davidson®"
],
"Type": [
"Touring"
],
"For Sale By": [
"Dealer"
],
"Vehicle Title": [
"Clear"
],
"Mileage": [
"13393"
],
"VIN (Vehicle Identification Number)": [
"1HD1KTM10GB627264"
],
"Color": [
"Black Quartz"
]
},
"description": "Item description goes here",
"imageUrls": [
"https://dw4i9za0jmiyk.cloudfront.net/2018/01/12/pre_ic60e5df584b870c3d2a55c86800eede_70618b24eb08.jpg"
]
},
"condition": "USED_EXCELLENT",
"availability": {
"pickupAtLocationAvailability": [
{
"quantity": 1,
"merchantLocationKey": "425",
"availabilityType": "IN_STOCK",
"fulfillmentTime": {
"value": 1,
"unit": "DAY"
}
}
]
}
}
And my offer object is as follows:
{
"offerId": "5852159010",
"sku": "13725",
"marketplaceId": "EBAY_MOTORS",
"format": "FIXED_PRICE",
"availableQuantity": 0,
"pricingSummary": {
"price": {
"value": "18294.0",
"currency": "USD"
}
},
"listingPolicies": {
"paymentPolicyId": "5807565000",
"fulfillmentPolicyId": "5806186000"
},
"categoryId": "49996",
"merchantLocationKey": "425",
"tax": {
"applyTax": false
},
"status": "UNPUBLISHED",
"eBayPlusEligible": false
}
I had similar issues on sandbox, and came to the conculsion it was broken.
They also have some limits on only certain categories working.
Have you tried it agains the live API, I have found this to be far more reliable, ignoring the fact doing development work live is dangerous!
For your info here is my working code offer:
inventory_template = {
"availability": {
"shipToLocationAvailability": {
"quantity": product.quantity_available
}
},
"condition": "NEW",
"product": {
"aspects": {spec.name: [spec.value] for spec in product.specifics},
"brand": product.product_brand,
"description": product.product_description,
"imageUrls": [
"https://ebay.mydomain.co.uk/{}".format(img.image_link) for img in product.images],
"mpn": product.product_mpn,
"title": product.product_title,
"upc": [
product.product_upc,
],
"ean": [
product.product_ean,
],
# "epid": "string"
},
"sku": sku,
}
offer_body = {
"availableQuantity": offer.available_quantity,
"categoryId": offer.category_id,
"listingDescription": html,
"listingPolicies": {
"paymentPolicyId": offer.payment_policy_id,
"returnPolicyId": offer.return_policy_id,
"fulfillmentPolicyId": offer.fulfillment_policy_id,
},
"merchantLocationKey": offer.merchant_location_key,
"pricingSummary": {
"price": {
"value": offer.summary_price_value,
"currency": offer.summary_price_currency
}
},
"sku": offer.sku,
"marketplaceId": offer.marketplace_id,
"format": offer.format
}
the offer.available_quantity etc are items from my database, its the structure I'm showing.

add tracking to mandrill send-template

My mandrill keeps saying my message is not opened when I call messages/info.json despite I have added tracking.
here is my request:
{
"key": "mykey",
"template_name": "message",
"template_content": {},
"message": {
"html": null,
"text": null,
"subject": "test",
"from_email": "info#test.io",
"from_name": "test",
"to": [
{
"email": "rob.proesmans#test.be",
"name": "rob",
"type": "to"
}
],
"headers": null,
"important": null,
"track_opens": true,
"track_clicks": true,
etc..
my mandrill response when i call /messages/info.json
{
"ts": 1455290984,
"_id": "3e5877fc43044841ab505f999b4a5b00",
"state": "sent",
"subject": "test",
"email": "rob.proesmans#redtree.be",
"tags": {},
"opens": 0,
"clicks": 0,
"smtp_events": [
{
"ts": 1455290986,
"type": "sent",
"diag": "250 2.0.0 OK 5E/A9-30218-21AFDB65",
"source_ip": "198.2.134.26",
"destination_ip": "94.143.184.119",
"size": 23062
}
],
"resends": {},
"sender": "info#redtree.io",
"template": "pocmessage",
"opens_detail": {},
"clicks_detail": {}
}
After 5minutes.. still no result after opening the mail..
What am i doing wrong?
Thank you
I takes around 2 hours till Mandrill knows when your mail is opened.

Getting all locked files using the BOX API (BOX.com)

I am trying to find a solution to search/list all locked files in BOX (BOX.com).
As this seems not to be possible through the user-interface, I investigated the Rest API.
I cannot find a way to search for all locked files using the API.
I cannot iterate through the API.
I cannot have a wildcard search using the "fields=lock" as parameter.
Currently I can query if a single file is locked by:
https://api.box.com/2.0/files/26802142333?fields=lock
which returns
{
"type": "file",
"id": "26802142333",
"etag": "462",
"lock": {
"type": "lock",
"id": "22148533",
"created_by": {
"type": "user",
"id": "201274112",
"name": "Robert Wunsch",
"login": "rwunsch#sapient.com"
},
"created_at": "2015-05-11T11:36:08-07:00",
"expires_at": null,
"is_download_prevented": false
}
}
And I can create a search using the "fields=lock" parameter, with a query to search e.g. everything containing "xls":
https://api.box.com/2.0/search?query=xls&fields=lock
which returns
...,
{
"type": "file",
"id": "29299819893",
"etag": "0",
"lock": null
},
{
"type": "file",
"id": "26004664251",
"etag": "0",
"lock": null
},
{
"type": "file",
"id": "26004640461",
"etag": "0",
"lock": null
},
{
"type": "file",
"id": "29618844701",
"etag": "3",
"lock": {
"type": "lock",
"id": "22002195",
"created_by": {
"type": "user",
"id": "202820453",
"name": "Robert Wunsch",
"login": "gincalua#googlemail.com"
},
"created_at": "2015-05-06T05:33:28-07:00",
"expires_at": null,
"is_download_prevented": false
}
},
{
"type": "file",
"id": "26004659155",
"etag": "0",
"lock": null
},
{
"type": "file",
"id": "29063166840",
"etag": "0",
"lock": null
},
...
How do I can I search for the locked files?
Thanks for the Help!
I don't believe the API has a way of efficiently retrieving all locked files.
The only reliable solution would be to walk the entire folder tree and check each file to see if it's locked. However, this will be slow if you have a lot of files or a very deep hierarchy, as you'll need to make at least one API request per folder.