Calling REST API Patch from an ECM Datalink

Thanks! I’ll bring it up in the ECM focus group that we would like more documentation.

I noticed you don’t have a datalink selected in the lower picture when you test the rest.

I would make sure the top area is just the Erplogin information with the authparameter.

Under datalinks, select the datalink and test live. The rest of the information looks correct.

2 Likes

@microlan Yes the top is the login get a token only. The bottom references the token and does the work.

1 Like

How do you get involved with the ECM focus group?

1 Like

they asked and were looking for people. Are you interested?

Yes, I would be interested to get involved if I can :smiley:

1 Like

ok - I’ve been lurking a bit on this and trying to follow along and set my datalinks up just to get it working. Seems I’m stuck in the same place, so I’ll reiterate my setup here in hopes someone can find the glitch. Note, my error is different - and I’ve tried all kinds of variations of both the connection and the datalink structure.

I’m trying a parameter-less BAQ provided by Epicor to remove any notion that my BAQ doesn’t work correctly.

Sure wish there was some examples provided by the ECM Team.
@utaylor can you make that request too?

EDIT - Fixed the missing ‘[’ because I typo’d

[
    {
        "Url": "https://server.ashworth.com/ashworthtest/TokenResource.svc",
        "Method": "Get",
        "AuthScheme": "Basic",
        "AuthParameter": "bWxxxxxxxxxxxxxxx0NDEx",
        "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"
            }
        ]
    }
]

Here is the Datalink spec

[
    {
        "URL": "https://server.ashworth.com/ashworthtest/api/v1/BaqSvc/zJCDept",
        "Method": "Get",
        "AuthScheme": "@TokenType",
        "AuthParameter": "@AccessToken",
        "Body": null,
        "CollectionPath": null,
        "WSHeaders": [
            {
                "Key": null,
                "Value": null
            }
        ],
        "Columns": [
            {
                "Name": "JCDept_JCDept",
                "Path": "JCDept_JCDept",
                "ChainOutput": null
            },
            {
                "Name": "JCDept_Description",
                "Path": "JCDept_Description",
                "ChainOutput": null
            },
            {
                "Name": "JCDept_Company",
                "Path": "JCDept_Company",
                "ChainOutput": null
            },
            {
                "Name": "RowIdent",
                "Path": "RowIdent",
                "ChainOutput": null
            }
        ],
        "ContentType": "application/json",
        "Parser": 0,
        "EscapeParameters": false,
        "XMLNameSpaces": null
    }
]

And the error message I get is
image

From a URL - works just fine. It asks for credentials and returns data.

Your top Datalink seems to be missing the first “[” at the very top, but I am somewhat doubtful this is the issue as I don’t believe it would allow you to save it if it wasn’t there…

It should also be a POST and not a GET method.

If yours still isn’t working, try using this format and simply replacing the username:password with your encoded one.

[
  {
    "Name": "ErpLogin",
    "Url": "https://server.ashworth.com/ashworthtest/TokenResource.svc/",
    "Method": "Post",
    "AuthScheme": "Basic",
    "AuthParameter": "**<username:password>**",
    "AllowInvalidSSL": false,
    "LogPath": "C:\\temp\\Login.log",
    "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"
      }
    ]
  }
]
1 Like

You guys are ALL Awesome!!!
We will post some documentation on what we are doing and how we can all benefit from this!

1 Like

I have success… The help is greatly appreciated. I will look to return the favor to this group. Used the top Connection box to obtain the token , and the bottom DataLink Call definition to call the BAQ , pass parameters… Feeling giddy right now. Now have to figure out why it worked so can use on other BO…

[
    {
        "URL": "api/v1/BaqSvc/COMP01-GetJobs/?PackNum=@PackNum",
        "Method": "Get",
        "AuthScheme": "@TokenType",
        "AuthParameter": "@AccessToken",
        "Body": null,
        "CollectionPath": "value",
        "WSHeaders": [
            {
                "Key": "CallSettings",
                "Value": "{PackNum: @PackNum}"
            }
        ],
        "Columns": [
            {
                "Name": "ShipDtl_PackNum",
                "Path": "ShipDtl_PackNum",
                "ChainOutput": null
            },
            {
                "Name": "Calculated_Job",
                "Path": "Calculated_Job",
                "ChainOutput": null
            }
        ],
        "ContentType": "application/json",
        "Parser": 0,
        "EscapeParameters": false,
        "XMLNameSpaces": null
    }
] 

1 Like

Oh !! where is the log located ? thanks

You don’t have a path set in your ErpLogin

“LogPath”: “C:\temp|Login.log”

1 Like

Just stopping by this never ending thread to drop two little bits.

One, if y’all don’t know about it already is this site to check your json structures:

And two… how to post your json and other code in the forum in a code block:

These are code blocks in your posts: The ` character is a backtick, and it is usually located under the tilde ~ key under the ESC button on most keyboards.

```
//Default. Most people just use this one
```

There are more, depending on what the site is configure for:
@josecgomez , what else is configured for here?

`Single Line of Code` → Single Line of Code

```json
//Json
```

```javascript
//Javascript Code
```

```js
//This works for the above two as well, don’t know if there are any differences
//in highlighting
```

```cs
//C# Code
```

```sql
–SQL Code
```

```text
Put text here
```

Edit: Cool, JsonLint had a link to Markdown Editor:
https://markdowneditor.org/

Which has all this listed: (I knew some, but not all!)

# Welcome to Markdown Editor

The markdown code below showcases various markdown features. Enjoy!

# Header 1
## Header 2
### Header 3
#### Header 4
##### Header 5
###### Header 6

## Emphasis

**Bold Text**

*Italic Text*

~~Strikethrough~~

## Lists

### Unordered
- Item 1
- Item 2
  - Subitem 2.1
  - Subitem 2.2

### Ordered
1. First Item
2. Second Item
3. Third Item

## Links
[Google](http://www.google.com)

## Images
![Markdown Logo](https://markdowneditor.org/images/favicon-32x32.png)

## Blockquotes
> This is a blockquote. 

## Horizontal Line
---

## Code

Inline `code` has `back-ticks around` it.

```javascript
var s = "JavaScript syntax highlighting"
alert(s)
s = "Python syntax highlighting"
print(s)

Tables

Header 1 Header 2 Header 3
Row1Col1 Row1Col2 Row1Col3
Row2Col1 Row2Col2 Row2Col3
Row3Col1 Row3Col2 Row3Col3

Checkboxes

  • Task 1
  • Task 2
  • Task 3

Enjoy writing in Markdown!

 
# Welcome to Markdown Editor

The markdown code below showcases various markdown features. Enjoy!

# Header 1
## Header 2
### Header 3
#### Header 4
##### Header 5
###### Header 6

## Emphasis

**Bold Text**

*Italic Text*

~~Strikethrough~~

## Lists

### Unordered
- Item 1
- Item 2
  - Subitem 2.1
  - Subitem 2.2

### Ordered
1. First Item
2. Second Item
3. Third Item

## Links
[Google](http://www.google.com)

## Images
![Markdown Logo](https://markdowneditor.org/images/favicon-32x32.png)

## Blockquotes
> This is a blockquote. 

## Horizontal Line
---

## Code

Inline `code` has `back-ticks around` it.

```javascript
var s = "JavaScript syntax highlighting"
alert(s)
s = "Python syntax highlighting"
print(s)

Tables

Header 1 Header 2 Header 3
Row1Col1 Row1Col2 Row1Col3
Row2Col1 Row2Col2 Row2Col3
Row3Col1 Row3Col2 Row3Col3

Checkboxes

  • Task 1
  • Task 2
  • Task 3

Enjoy writing in Markdown!

2 Likes

Everyone misses the basics— especially when you are looking at code for hours. I think most of us can agree we miss a ‘’ or “” or ( or ]. I don’t think this thread was about the basics. This thread has been very helpful as there’s no documentation on the structure we have to create these JSON datalinks. It doesn’t exist. Please prove me wrong. I’ll gladly say I’m wrong and thank you for the documentation. (Would be amazing!)

I do think the link you sent was helpful to the thread. But maybe not in the way you presented it.

Sorry if I’m misunderstanding your reply, however, this group has been excellent and contributed so much.!-}{#%!

You are. Just providing some helpful information, with a tiny bit of pulling a few chains, mainly @MikeGross for missing the bracket lol.

Okay, okay, gotta be part of the convo to bust in like that. lol.
Either way, I appreciate your contributions and I hope this thread continues.

I’m just jealous I don’t have ecm so I couldn’t participate.

1 Like

Parting Question…
Does this WebService DataLink work with UPDATE BO’s or just retrieval of data ? Any examples of the UPDATE ? How about an Update BAQ ?

1 Like

I have found update a little tricky in the past so I tend to “cheat” and call an updatable BAQ instead. Which answers your other question. Yes, updatable BAQ’s work nicely.
Calling business objects also works well, example is that I have a process driven from an ECM form that creates a Sales Order and Order Lines.

I might be a bit behind the curve here as I was an early adopter and so I am using the DLL, but I haven’t yet successfully used API v2 yet. I want to get there so I can call EPICOR functions also :smiley:

1 Like

Haha, yes @Anthony_Gercar that’s the first step @microlan , defining a log in your call :joy: