Home > Forum > General > PowerShell script to Import SP List data to Webcon Dictionary

PowerShell script to Import SP List data to Webcon Dictionary
0

Hi,

I am still learning Webcon and currently exploring the Webcon API. I would like to understand more about authorization, invoking REST methods, and specifying the path for importing data into the correct dictionary.

I’ve attached an image of my sample script, which successfully retrieves SharePoint data, but it encounters an error with Webcon authorization. I would appreciate guidance on what specific steps I should take or modifications I need to make.

Thanks and Regards,

MVP

Hi,

In the screenshot you passed the client id "Bearer GUID". You need to fetch an auth token first and then you can use this as the value for authorization.


Here are a few locations where you can find more information:


The developer page would be the first place to go:
https://developer.webcon.com/docs/basic-operations


You can also take a look at the following repositories:
The official repository with an application to import data. I have never used it.
https://github.com/WEBCON-BPS/RestApi-DataImporter/tree/main

Maksymilians repository:
https://blog.lumenn.pl/importing-data-to-webcon-3/

I can also recommend this PowerShell module. I use it a lot to read /write data to Excel. It's really great because it doesn't use Excel.
https://github.com/dfinke/ImportExcel

Here's my repository which uses the Excel PowerShell module and some other WEBCON REST API to write Excel files:
https://github.com/Daniel-Krueger/webcon_playwright/blob/iteration3/PowerShell/UtilityFunctions.psm1


Best regards,
Daniel

MVP

Daniel gave a good list of resources, I'll try to point out things you might have to correct based on the screenshot.

1 First you should fetch access_token from webcon, you could do it like that:
Look at lines 3-13
https://github.com/lumenn/webcon-data-import/blob/7dc59431595118ba9845e5cca4097b5095c43100/Import-Customers.ps1#L3-L13

2. Request body in your exapmle doesn't have correct schema,
You might look at this example lines 51-86, you have to specify at least workflow, form type, businessentity, and form fields as array of objects made of GUID/ID and value.
https://github.com/lumenn/webcon-data-import/blob/7dc59431595118ba9845e5cca4097b5095c43100/Import-Customers.ps1#L51-L86

3. I'm not sure where you have found this endpoint (/9fc58732/api/dictionarieses/5513f77b-d72g-455c-9349-993b35d177e0/entries), as It's not in the docs.
It should be /api/data/v5.0/db/{dbid}/elements an example here:
https://github.com/lumenn/webcon-data-import/blob/7dc59431595118ba9845e5cca4097b5095c43100/Import-Customers.ps1#L94

MVP
In reply to: S Blue

Hello, Where exactly can I see my client_id and client secret. Already tried checking on Admin Panel then API and I can't seem to see it maybe because this is a trial account, not sure though.

Hi,
on the Integrations -> API there should be a button to create new application, after creating one, it will get Client ID, and later you can add Secret on that application.

Ability to add new API's require global administration privileges, as described here: https://developer.webcon.com/docs/registration-and-authentiaction/

MVP
In reply to: S Blue

Hello, Where exactly can I see my client_id and client secret. Already tried checking on Admin Panel then API and I can't seem to see it maybe because this is a trial account, not sure though.

Hi

Maks and Jack already described where you can set it. I just want to point out, that this is part of the official developer documentation

https://developer.webcon.com/docs/registration-and-authentiaction
https://developer.webcon.com/docs/scopes-and-permissions
https://developer.webcon.com/docs/basic-operations

Best regards,
Daniel