Discussions
Does anyone know why BadRequest: ValidationError occurs here?
I send this JSON which is VALIDATED by JsonLint. But each time I POST the following code I receive the BAdRequest/Validation Error but no further details from iMIS Scheduler. I can GET, but cannot PUT or POST.
Here is the C# code:
static async Task<HttpResponseMessage> Update(string id)
{
PersonData existingParty;
var responseItem = await Client.GetAsync($"api/party/{id}");
if (responseItem.IsSuccessStatusCode)
{
// deserialize response to DataContract
existingParty = JsonConvert.DeserializeObject<PersonData>(await responseItem.Content.ReadAsStringAsync(), new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All });
}
else return responseItem;
// make minor update to the party
existingParty.WebsiteUrl = Guid.NewGuid().ToString();
// serialize person data
var serializedParty = JsonConvert.SerializeObject(existingParty, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All });
HttpContent httpContent = new StringContent(serializedParty, Encoding.UTF8, "application/json");
var response = await Client.PutAsync($"api/party/{id}", httpContent);
return response;
}
The JSON payload package returns "BadRequest/Validation Error"
{
"$type": "Asi.Soa.Membership.DataContracts.PersonData, Asi.Contracts",
"PersonName": {
"$type": "Asi.Soa.Membership.DataContracts.PersonNameData, Asi.Contracts",
"FirstName": "Jeff",
"LastName": "Kase",
"FullName": "Jeff Kase"
},
"AdditionalAttributes": {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
"$values": [{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "IsMember",
"Value": {
"$type": "System.Boolean",
"$value": false
}
}, {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "IsInactiveMember",
"Value": {
"$type": "System.Boolean",
"$value": false
}
}, {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "AllowAdvanceRenewal",
"Value": {
"$type": "System.Boolean",
"$value": false
}
}, {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "JoinDate",
"Value": "0001-01-01T00:00:00"
}, {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "MajorKey",
"Value": "14744"
}]
},
"Addresses": {
"$type": "Asi.Soa.Membership.DataContracts.FullAddressDataCollection, Asi.Contracts",
"$values": []
},
"AlternateIds": {
"$type": "Asi.Soa.Core.DataContracts.AlternateIdDataCollection, Asi.Contracts",
"$values": [{
"$type": "Asi.Soa.Core.DataContracts.AlternateIdData, Asi.Contracts",
"Id": "14744",
"IdType": "MajorKey"
}, {
"$type": "Asi.Soa.Core.DataContracts.AlternateIdData, Asi.Contracts",
"Id": "14744",
"IdType": "Id"
}]
},
"Emails": {
"$type": "Asi.Soa.Membership.DataContracts.EmailDataCollection, Asi.Contracts",
"$values": [{
"$type": "Asi.Soa.Membership.DataContracts.EmailData, Asi.Contracts",
"Address": "[email protected]",
"EmailType": "_Primary",
"IsPrimary": true
}]
},
"FinancialInformation": {
"$type": "Asi.Soa.Membership.DataContracts.FinancialInformationData, Asi.Contracts"
},
"Salutations": {
"$type": "Asi.Soa.Membership.DataContracts.PartySalutationDataCollection, Asi.Contracts",
"$values": [{
"$type": "Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
"SalutationId": "14744:LIST_AS",
"SalutationMethod": {
"$type": "Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
"PartySalutationMethodId": "LIST_AS"
},
"Text": "Jeff Kase"
}]
},
"SocialNetworks": {
"$type": "Asi.Soa.Membership.DataContracts.PartySocialNetworkDataCollection, Asi.Contracts",
"$values": []
},
"CommunicationTypePreferences": {
"$type": "Asi.Soa.Membership.DataContracts.PartyCommunicationTypePreferenceDataCollection, Asi.Contracts",
"$values": []
},
"SortIsOverridden": false,
"UpdateInformation": {
"$type": "Asi.Soa.Core.DataContracts.EntityUpdateInformationData, Asi.Contracts",
"CreatedBy": "ADMINISTRATOR",
"CreatedOn": "2018-09-27T09:19:05.22",
"UpdatedBy": "[email protected]",
"UpdatedOn": "2018-09-28T10:04:11.15"
},
"WebsiteUrl": "9aa577f7-642a-4314-8489-32356dfc188e",
"PartyId": "14744",
"Id": "14744",
"UniformId": "557090fb-ca0c-4f4c-8e92-475dc9f5dba3",
"Status": {
"$type": "Asi.Soa.Membership.DataContracts.PartyStatusData, Asi.Contracts",
"PartyStatusId": "",
"Name": "",
"Description": ""
},
"Name": "Jeff Kase",
"Sort": "Kase, Jeff"
}
Thanks for the input
Posted by Jack over 4 years ago
Membership REST Documentation
The membership REST Documentation and what's in Postman to create members are not matching up at all. I want to do the minimal to add a contact to our system, but what's in Postman and what's in Swagger (https://testapi.imis.com/swagger/?url=https://testapi.imis.com/sdkdemo/json/membership.json) is not matching up.
I even looked at the example here: https://developer.imis.com/v0.1/reference/api-endpoints-5#postparty and there's no way this is going to work. I try to use PartyData and all I get are 400 Bad Requests. When I change it to PersonData which doesn't exist here: https://testapi.imis.com/swagger/?url=https://testapi.imis.com/sdkdemo/json/membership.json I can finally create a user.
We are on 2017 Service Pack I. Is the documentation by chance version 23?
Posted by Jamie Rytlewski about 5 years ago
Communication Log - REST API, different Message Type
How do I add something to the Communication log using a Message Type other than email? The SQL table CommunicationMessageTypeRef has 4 different options, and I want to use something other than "Email" but I can't figure out which field in which call to insert the different value. Everything I try just shows Email on the output. I have no problems (now) writing to the log (3 POST calls but it's there), just can't get that value correct.
Thanks.
Posted by Jake Bound about 5 years ago
REST API: Custom Demographics Insert/Update
Is it possible to insert/update custom demographics through the REST APIs?
Posted by Chris Green over 4 years ago
AddItem throws Object Not Set to Instance of Item
I have an older version of iMIS. Something changed in iMIS and now our custom cart code throws an Object not Set to instance of item...
we suspect it may be payment methods or shipping method. Here is stack trace on cart.AddItem()
Server Error in '/processor' Application.
Error: Service Error: Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ServiceModel.FaultException: Error: Service Error: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FaultException: Error: Service Error: Object reference not set to an instance of an object.
]
Asi.Soa.ClientServices.CartManager.AddLine(OrderLineData line, Uri websiteEditUrl) +497
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl, String sourceCode, String shipToPartyId, String orderLineNote) +755
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl, String sourceCode, String shipToPartyId) +97
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl, String sourceCode) +88
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl) +79
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity) +67
USPTA_InsurancePurchase.USPTA_InsurancePurchaseDisplay.btnCheckout_Click(Object sender, EventArgs e) in c:\Users\ascension\Source\Repos\uspta\USPTA_InsurancePurchase\USPTA_InsurancePurchase\USPTA_InsurancePurchaseDisplay.ascx.cs:553
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11765069
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1665
Posted by Jack Donahue about 5 years ago
iMIS cart.AddItem() throws error
We think this has to do with a shipping method and/or payment method or "something" in the cart AddItem process that is required, but not present. However - code has been running fine for years. Someone DID remove Shipping Methods, and we see that Payment Details on the Cart_Home page is missing. The item gets added, but no pricing is there either.
cart.AddItem("PRODUCTCODE", Convert.ToDecimal(quantity)); //pseudo
The failure occurs in the Asi.Client.ServiceModel dll v20.2.49.5903
Any idea how to trace down this error. I can manipulate the cart further and see which objects are present at the time of the call. Here is the stack trace:
Error: Service Error: Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ServiceModel.FaultException: Error: Service Error: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FaultException: Error: Service Error: Object reference not set to an instance of an object.
]
Asi.Soa.ClientServices.CartManager.AddLine(OrderLineData line, Uri websiteEditUrl) +497
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl, String sourceCode, String shipToPartyId, String orderLineNote) +755
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl, String sourceCode, String shipToPartyId) +97
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl, String sourceCode) +88
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl) +79
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity) +67
USPTA_InsurancePurchase.USPTA_InsurancePurchaseDisplay.btnCheckout_Click(Object sender, EventArgs e) in c:\Users\ascension\Source\Repos\uspta\USPTA_InsurancePurchase\USPTA_InsurancePurchase\USPTA_InsurancePurchaseDisplay.ascx.cs:553
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11765069
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1665
Posted by Jack Donahue about 5 years ago
Can I write to the communication log via REST?
I believe someone said last week at Innovations that there was an endpoint to write to the communication log via REST. Is that a thing? I'd like to be able to say something like "I sent an email to ID 101 (or ContactKey ABC12...) at 3:45am with this content". Nothing different than what's being logged. Thanks.
Posted by Jake Bound about 5 years ago
Adding Structured Snippet, Meta tags, and opengraph data to iMIS
Hello,
I am a digital marketer and SEO specialist for my company and we are unable to run the most recent version of iMIS RiSE platform due to a variety of reasons but I still need to add requisite information to the headers of individual pages as well as tags to the pages themselves to comply with industry standards. This provides a few questions/challenges:
1. How do I create rel canonical and other metatags in page headers?
2. How do I add schema.org JSON scripting to add structured data and open-graphs?
3. Is there a way to edit headers beyond the template?
4. Do I have to go through and hard code the scripting and open-graphs to the various pages?
I would like to just focus on these despite further questions. Does anyone know of a solution to add these in iMIS?
Posted by Samantha Logan over 3 years ago
Can we get a CURL test for POST to /TOKEN?
We have a third party (mobile app) testing against the exposed iMIS REST API.
They are sending this CURL:
curl -H "content-type: application/x-www-form-urlencoded" -d '{"grant_type":"password","username":"XXXXXXX","password":"XXXXX}' -v 'https://ourclientdomainiscorrect/Asi.Scheduler_USAB/Token'
They receive this error:
{"error":"unsupported_grant_type"}
Does anyone see a problem with the CURL or could we get a proper CURL to send over to them that assuredly is good to receive the TOKEN?
A lot of people use CURL to test. Asking them to switch to Postman is a non-starter.
Jack Donahue
Posted by JAck over 4 years ago
"Refresh token lifetime" in the SSO doesn't seem to be honoured
I have an SSO application setup that works, but the "Refresh token lifetime" value doesn't seem to be honoured across the problem. I have the Refresh token lifetime (minutes) variable set to 1440 minutes, but the refresh value I get back following a call to /api/token is "expires_in":1199. It's always 1199 regardless of the value I set it to in the iMIS configuration. Do I need to keep resetting it? Thanks.
Posted by Jake Bound almost 5 years ago