Simple json Patch to update one field

I have been attempting to get the syntax nailed to update one ERP Table field in a json datalink file (learning this as I go, don’t know all the proper terms). I have been able to get the “ErpLogin” and “GetSalesOrderHeader” working below but no luck with the “PatchSalesOrder”.

The error I get is during the Test Live is:

image

All parameters set to test values in ECM Admin DataLink Manager


{
    "Name": "ErpLogin",
    "Url": "https://epicor10app/epicordts/TokenResource.svc/",
    "Method": "Post",
    "AuthScheme": "Basic",
    "AuthParameter": "xxxxxxxxxxxxxxxxxxxxx",
    "AllowInvalidSSL": false,
    "LogPath": "C:\\ProgramData\\Eclipse\\DatalinkExecutables\\ErpLoginLog.txt",
    "WSHeaders": [
      {
        "Key": "a",
        "Value": "b"
      }
    ],
    "Columns": [
      {
        "Name": "AccessToken",
        "Path": "AccessToken",
        "ChainOutput": "@AccessToken"
      },
      {
        "Name": "TokenType",
        "Path": "TokenType",
        "ChainOutput": "@TokenType"
      },
      {
        "Name": "ExpiresIn",
        "Path": "ExpiresIn"
      },
      {
        "Name": "RefreshToken",
        "Path": "RefreshToken"
      }
    ]
  },
  {
    "Name": "GetSalesOrderHeader",
    "Url": "https://epicor10app/epicordts/api/v1/Erp.BO.SalesOrderSvc/SalesOrders(@CompanyId,@OrderNum)",
    "Method": "Get",
    "AuthScheme": "@TokenType",
    "AuthParameter": "@AccessToken",
    "AllowInvalidSSL": false,
    "LogPath": "C:\\ProgramData\\Eclipse\\DatalinkExecutables\\GetSalesOrderHeaderLog.txt",
    "WSHeaders": [
      {
        "Key": "CallSettings",
        "Value": "{Company: \"@CompanyId\", Plant: \"@Plant\"}"
      }
    ],
    "Columns": [
      {
        "Name": "OrderNum",
        "Path": "OrderNum"
      },
      {
        "Name": "PONum",
        "Path": "PONum"
      },
      {
        "Name": "DTQuoteNum",
        "Path": "ShortChar09"
      },
      {
        "Name": "ProjectID",
        "Path": "Character09"
      }
    ]
  },
  {
    "Name": "PatchSalesOrder",
    "Url": "https://epicor10app/epicordts/api/v1/Erp.BO.SalesOrderSvc/SalesOrders(@CompanyId,@OrderNum)",
    "Method": "Patch",
    "AuthScheme": "@TokenType",
    "AuthParameter": "@AccessToken",
    "AllowInvalidSSL": false,
    "LogPath": "C:\\ProgramData\\Eclipse\\DatalinkExecutables\\PatchSalesOrderLog.txt",
    "CallChain": "ErpLogin",
    "Body": "{ \"ShortChar09\": \"@DTQuoteNum\" }",
    "WSHeaders": [
      {
        "Key": "CallSettings",
        "Value": "{Company: \"@CompanyId\", Plant: \"@Plant\"}"
      }
    ]
  },

Can someone chime in to shed some light on what I am missing?

Thanks

MIke

Try to add Company and Order ID into body as well

1 Like

No luck.

{
    "Name": "PatchSalesOrder",
    "Url": "https://epicor10app/epicordts/api/v1/Erp.BO.SalesOrderSvc/SalesOrders(@CompanyId,@OrderNum)",
    "Method": "Patch",
    "AuthScheme": "@TokenType",
    "AuthParameter": "@AccessToken",
    "AllowInvalidSSL": false,
    "LogPath": "C:\\ProgramData\\Eclipse\\DatalinkExecutables\\PatchSalesOrderLog.txt",
    "CallChain": "ErpLogin",
    "Body": "{ \"Company\": \"@CompanyId\",\"OrderNum\": \"@OrderNum\",\"ShortChar09\": \"@DTQuoteNum\" }",
    "WSHeaders": [
      {
        "Key": "CallSettings",
        "Value": "{Company: \"@CompanyId\", Plant: \"@Plant\"}"
      }
    ]
  },

I am not even getting a Log file out of this like I do on the others.

I forgot how to surround code to make it a block… ugg

This works

PATCH /EpicorTest/api/v1/Erp.BO.SalesOrderSvc/SalesOrders(C001,100003) HTTP/1.1
Host: epicortld.stephengould.com
Authorization: Basic <mysecretpassword>
Content-Type: application/json
Content-Length: 34

{
  "sgcPrepaymentAmt_c": "32"
}
1 Like

Will I be able to test that from the Data Link Test?

Thank you Jose

Your body has ShortChar09, that is not a OrderHed field. That looks like a UD table field to me, which would have to be set through the corresponding UD service.

It works on Our Rest API web help ???

https://“myserver/instance”/api/help/v1/odata/Erp.BO.SalesOrderSvc/index#!/OData/updateExt_SalesOrder

curl -X PATCH --header ‘Content-Type: application/json’ --header ‘Accept: application/json’ -d ‘{ \
“Character09”: “I Got this”, \
“ShortChar09”: “666666” \
}’ ‘https://“myserver/instance”/api/v1/Erp.BO.SalesOrderSvc/SalesOrders(DTSF,11800)’

Yeah that’s fine ShortChar09 is part of the OrderHed_UD table which is rolled in via the BO so that should work fine.