Skip to content

Test the service

Using PowerShell

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
    C:\Users\Administrator> $credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "go_user",(ConvertTo-SecureString -AsPlainText -Force -String '[yourpasswordtoEPR]')
    C:\Users\Administrator> $testServiceParams = @{
        Method = 'POST'
        Uri = 'http://localhost:8085/api/script'
        Credential = $credentials
        AllowUnencryptedAuthentication = $true
        Body = '{"importHandlerIdentifier":"testService.ps1"}'
        ContentType = 'application/json'
    }
    C:\Users\Administrator> Invoke-RestMethod @testServiceParams

    importItemResult
    ----------------
    {@{result=OK}}

    C:\Users\Administrator>

Using Postman

Create a collection

  1. Open Postman.
  2. In the top left corner, click on the 3 lines-icon, click on File and the New.
  3. Click on Collection.
  4. Give the collection a name like "EPR-Test".
  5. Just below the name you gave the collection you should have "Authorization", click on it to ensure it is the active tab.
  6. Set Basic Auth as Type and enter the credentials to your instance of EPR.
  7. Click on Save or use CTRL+S.
  8. Click on "Variables".
  9. Enter a new variable with the name url, initial value and default value should be the "base url" to EPR. It could be http://eprserver.domain.com/api or http://localhost:8089/api.
  10. Click on Save or use CTRL+S.

Create a ping request

  1. Hover over the collection in the left pane, and click on the 3 dots at appear.
  2. Click on Add request.
  3. Name the request "Ping".
  4. Enter the following where is says "Enter request URL": {{url}}/ping
  5. Click on Save, or use CTRL+S, and then click Send.
  6. You should get a response in the lower pane looking some this:
    1
    2
    3
        {
            "message": "Pong!"
        }
    

Create a POST request

  1. Hover over the collection in the left pane, and click on the 3 dots at appear.
  2. Click on Add request.
  3. Name the request "Test the service".
  4. Enter the following where is says "Enter request URL": {{url}}/script
  5. Click on the tab "Body" just under the URL field and paste the JSON example below.
    1
    2
    3
        {
            "importHandlerIdentifier": "testService.ps1"
        }
    
  6. Click on Save, or use CTRL+S, and then click Send.
  7. You should get a response in the lower pane looking some this:
    1
    2
    3
    4
    5
    6
    7
        {
            "importItemResult": [
                {
                    "result": "OK"
                }
            ]
        }
    

When you have done that you should have a file called StringInput.txt in [EPRInstallRoot]/scripts with a timestamp and the json example above.

Using GO

  1. Configure an export configuration.
  2. Configure an item event handler with the function 'Export item' and "point" it to http://localhost:8085/api/script.
  3. Put testService.ps1 as identifier in the function configuration.
  4. Make the event handler execute, wait for the minute to pass, and you should have a file called StringInput.txt in [EPRInstallRoot]/scripts with the exported item from GO.