Skip to content

Get started with REST API

With the release of 1.29.2822 we've offically published our REST API.

Swagger URL for REST API

The URL for Swagger may be different depending on your Zervicepoint environment. In AdminWeb, click "REST API" link to access the URL in your environment.

Examples:

Authentication

Authentication with REST API can be done either by authentication through ADFS or Key. Only one authentication type can be set on the store. You can change authentication type in Admin Web > Edit Store > API Authentication.

Authorize with REST API using Key

Generate api key

  1. AdminWeb > Edit Store > API Authentication > Authentication Method: Key
  2. Add user > "Enter email" > Generate Key > Copy key to clipboard > Save Store settings.
  1. Go to swagger URL for zervicepoint
  2. Click Authorize. Enter "Bearer YOURKEY"
  3. Click Authorize.

Authorize with REST API using ADFS

On how to retrieve a saml token, please go to REST API Authentication.

  1. Go to swagger URL for zervicepoint
  2. Click Authorize. Enter "SAML YOURTOKEN"
  3. Click Authorize.

Location header

Post requests will return a location to the created resource in the response header.

# Place order
$wc = Invoke-WebRequest -Uri "https://HostName:30000/StoreName/api/Order" -Header  @{"accept"="application/json";"Authorization"="Bearer YOURKEY"} -Method Post -ContentType 'application/json' -Body $json
$wc.Headers
<# output

Key              Value                                                 
---              -----                                                 
Pragma           no-cache                                              
Content-Length   0                                                     
Cache-Control    no-cache                                              
Date             Tue, 02 Feb 2021 20:18:59 GMT                         
Expires          -1                                                    
Location         https://rt.zplab.se:30000/Store/api/Order?orderId=1160
Server           Zipper.ZervicePoint.WebApi/1.29.2822.0                
X-AspNet-Version 4.0.30319                                             
X-Powered-By     ASP.NET
#>

# Lookup the response of the order using location header

$getOrder = Invoke-WebRequest -Uri $wc.Headers.Location  @{"accept"="application/json";"Authorization"="Bearer YOURKEY"}

Examples

Info

In order for the examples below to work, you must replace HostName, StoreName and YOURKEY in the examples on this page.

Get all orders

Invoke-WebRequest -Uri "https://HostName:30000/StoreName/api/Order" `
-Header  @{"accept"="application/json";"Authorization"="Bearer YOURKEY"}

Get order by orderid

Invoke-WebRequest -Uri "https://HostName:30000/StoreName/api/Order?orderId=1000" `
-Header  @{"accept"="application/json";"Authorization"="Bearer YOURKEY"}

Get orders by serviceName

Invoke-WebRequest -Uri "https://HostName:30000/StoreName/api/Order?serviceName=Onboarding" `
-Header  @{"accept"="application/json";"Authorization"="Bearer YOURKEY"}

Get all orders from a specific date

Invoke-WebRequest -Uri "https://HostName:30000/StoreName/api/Order?orderDateFrom=2021-01-01" -Header  @{"accept"="application/json";"Authorization"="Bearer YOURKEY"}

Get all orders between specific dates

$body = @{
    "orderDateFrom" = "2021-01-01 08:00"
    "orderDateTo" = "2021-01-10 20:00"
}

Invoke-WebRequest -Uri "https://HostName:30000/StoreName/api/Order" -Header  @{"accept"="application/json";"Authorization"="Bearer YOURKEY"} -Body $body

Get all orders with an error

Invoke-WebRequest -Uri "https://HostName:30000/StoreName/api/Order?orderState=Error" -Header  @{"accept"="application/json";"Authorization"="Bearer YOURKEY"}

Get all orders with an error between specific dates

Invoke-WebRequest -Uri "https://HostName:30000/StoreName/api/Order?orderState=Error&orderDateFrom=2021-01-02&orderDateTo=2021-01-25" -Header  @{"accept"="application/json";"Authorization"="Bearer YOURKEY"}