我必须使用Postman在Dynamics(ac_sejour)中的非系统实体中创建记录。我尝试了多种请求,但遇到了400错误请求问题。我所做请求的示例:
{{资源源}}/api/数据/v9.2/访问权限或{{资源源}}/api/数据/v9.2/实体/访问权限
- 我将Data Json放在主体部分
我的错误如下:
"error": {
"code": "0x0",
"message": "Error identified in Payload provided by the user for Entity :'ac_sejours', For more information on this error please follow this help link https://go.microsoft.com/fwlink/?linkid=2195293 ----> InnerException : Microsoft.OData.ODataException: Cannot convert the literal '11122223333' to the expected type 'Edm.String'. ---> Microsoft.OData.ODataException: Cannot convert a value of type 'Edm.Decimal' to the expected target type 'Edm.String'.\r\n at Microsoft.OData.ODataPayloadValueConverter.ConvertFromPayloadValue(Object value, IEdmTypeReference edmTypeReference)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.OData.ODataPayloadValueConverter.ConvertFromPayloadValue(Object value, IEdmTypeReference edmTypeReference)\r\n at Microsoft.Crm.Extensibility.ODataV4.CrmPrimitivePayloadValueConverter.ConvertFromPayloadValue(Object value, IEdmTypeReference edmTypeReference)\r\n at Microsoft.OData.JsonLight.ODataJsonLightReaderUtils.ConvertValue(Object value, IEdmPrimitiveTypeReference primitiveTypeReference, ODataMessageReaderSettings messageReaderSettings, Boolean validateNullValue, String propertyName, ODataPayloadValueConverter converter)\r\n at Microsoft.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.ReadPrimitiveValue(Boolean insideJsonObjectValue, IEdmPrimitiveTypeReference expectedValueTypeReference, Boolean validateNullValue, String propertyName)\r\n at Microsoft.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.ReadNonEntityValueImplementation(String payloadTypeName, IEdmTypeReference expectedTypeReference, PropertyAndAnnotationCollector propertyAndAnnotationCollector, CollectionWithoutExpectedTypeValidator collectionValidator, Boolean validateNullValue, Boolean isTopLevelPropertyValue, Boolean insideResourceValue, String propertyName, Nullable`1 isDynamicProperty)\r\n at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadEntryDataProperty(IODataJsonLightReaderResourceState resourceState, IEdmProperty edmProperty, String propertyTypeName)\r\n at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadPropertyWithValue(IODataJsonLightReaderResourceState resourceState, String propertyName, Boolean isDeltaResourceSet)\r\n at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.<>c__DisplayClass9_0.<ReadResourceContent>b__0(PropertyParsingResult propertyParsingResult, String propertyName)\r\n at Microsoft.OData.JsonLight.ODataJsonLightDeserializer.ProcessProperty(PropertyAndAnnotationCollector propertyAndAnnotationCollector, Func`2 readPropertyAnnotationValue, Action`2 handleProperty)\r\n at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadResourceContent(IODataJsonLightReaderResourceState resourceState)\r\n at Microsoft.OData.JsonLight.ODataJsonLightReader.StartReadingResource()\r\n at Microsoft.OData.JsonLight.ODataJsonLightReader.ReadResourceSetItemStart(PropertyAndAnnotationCollector propertyAndAnnotationCollector, SelectedPropertiesNode selectedProperties)\r\n at Microsoft.OData.JsonLight.ODataJsonLightReader.ReadAtStartImplementationSynchronously(PropertyAndAnnotationCollector propertyAndAnnotationCollector)\r\n at Microsoft.OData.ODataReaderCore.ReadImplementation()\r\n at Microsoft.OData.ODataReaderCore.InterceptException[T](Func`1 action)\r\n at System.Web.OData.Formatter.Deserialization.ODataReaderExtensions.ReadResourceOrResourceSet(ODataReader reader)\r\n at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)\r\n at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)."
}
有人知道在动态中创建记录的URL是什么样子的吗?
注意:实体ac_sejour的说明:网址:
{{ressource}}/api/data/v9.2/entities?$filter=startswith(name,'ac_sejour')
Postman 回应:
"value": [
{
"entitysetname": "ac_sejours",
"logicalname": "ac_sejour",
"logicalcollectionname": "ac_sejours",
"entityid": "ab71bc28-0486-e911-a827-000d3a2aa91d",
"reportviewname": "Filteredac_sejour",
"basetablename": "ac_sejourBase",
"overwritetime": "1900-01-01T00:00:00Z",
"versionnumber": 382008802,
"originallocalizedcollectionname": "Séjours",
"name": "ac_sejour",
"componentstate": 0,
"physicalname": "ac_sejour",
"collectionname": "ac_sejours",
"solutionid": "fd140aae-4df4-11dd-bd17-0019b9312238",
"originallocalizedname": "Séjour",
"parentcontrollingattributename": null,
"externalcollectionname": null,
"extensiontablename": null,
"externalname": null,
"addresstablename": null
}
1条答案
按热度按时间oxiaedzo1#
有一个用于Dataverse的托管解决方案/附加工具,它将为您提供包含webapi调用的实际值的代码片段。工具是Dataverse Rest Builder
https://www.xrmtoolbox.com/plugins/GuidoPreite.DRB/
这应该给予你确切的有效载荷与你的实时数据。