Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Add_workflow_for_techpubs
AUTH1
JIRAIDAUTHSYM-22656
REV5
REV6
REV3
REV1

Panel
titleTable of Contents

Table of Contents
maxLevel2

...

Info

Starting with Release 3.0 of 

Spacevars
0longproduct
firmware, the REST license is free of charge and you can use it for multiple scenarios.

REST APIs are provided for developers who want to programmatically integrate the 

Spacevars
0longproduct
into their applications, and for administrators who want to script interactions with the
Spacevars
0longproduct
.

One An example is scripting provisioning, which allows you to program multiple SBCs with the same parameters, instead of manually programming each one. This is often the case when you need to deploy multiple SBCs in the same county, and must create the same routing and transformation tables manually each time.

This document article outlines tips for jumping into accessing REST programming through Microsoft Power ShellPowershell 3.

...

Prerequisites

Your system must include the following:

...

Verify the version of the host using the following command.

Code Block
$host.version

Login to REST

Login using a public signed certificate (untested)

...

Log into REST

Login without certificate

...

Code Block
$url= "https://134.56.226.215/rest/system?action=importconfig"
$body = "--MyBoundary`n"
$body += 'Content-Disposition: form-data; name="Filename"; filename="symphonyconfig.xml"'
$body += "`nContent-Type: application/xml`n`n"
$body += $(get-content symphonyconfig.xml -raw)
$body += "`n--MyBoundary--"
 
Invoke-RestMethod -uri $url -method POST -ContentType "multipart/form-data; boundary=MyBoundary" -body $body -WebSession $ps

Upload new Sbc Firmware (Does not work)

Log in with cURL

This operation allows login to the 

Spacevars
0product2
with cURL, and stores the PHP Session ID into Powershell for reuse later.

Code Block
$login = ./curl.exe -k --data "Username=restuser&Password=restpass" -i -v 
Code Block
$url= "https://134192.56168.226123.21553/rest/partition/1?action=upgrade"
$body = "--MyBoundary`n"
$body += 'Content-Disposition: form-data; name="Filename"; filename="sbc1000-release-3.1.0.img"'
$body += "`nContent-Type: application/octet-stream`n`n"
$body += $(get-content sbc1000-release-3.1.0.img -raw)
$body += "`n--MyBoundary--"
 
Invoke-RestMethod -uri $url -method POST -ContentType "multipart/form-data; boundary=MyBoundary" -body $body -WebSession $ps

Upload new SbcComms (Does not work)

...

login
$PHPSESSID = 0
foreach ($line in $login) {
    if ($line.contains("PHPSESSID=")) {
        $correctline = $line.split(";")
        $splitedline = $correctline.split("=")
        $PHPSESSID = $splitedline[1]
    }
}

Update SbcComms

This operation allows installation of 

Spacevars
0company
 
Spacevars
0product2
Communication service updates on the ASM. Refer to Resource - sbaconfig.

Query
Code Block
curl.exe --cookie PHPSESSID=$PHPSESSID -k -i https://134.56.226.215/rest/sbaconfig?action=sbaupgrade

...

 

...

-F sbaInstallFilename=@setup.msi
Response
Code Block
<?xml version="1.0"?>
<root>
 <status>
  <http_code>200</http_code>
 </status>
</root>
Action end on status
Code Block
$url = "https://134.56.226.215/rest/sbaactionstatus"
Invoke-RestMethod -Uri $url -Method GET -WebSession $MyPs
 
<?xml version="1.0"?>
<root>
 <status>
  <http_code>200</http_code>
 </status>
 <sbaactionstatus href="https://134.56.226.215/rest/sbaactionstatus">
  <rt_Success>1</rt_Success>
  <rt_ActionType>15</rt_ActionType>
  <rt_PercentComplete>100</rt_PercentComplete>
  <rt_Duration>5</rt_Duration>
  <rt_StatusText>setup.msi: Update Complete</rt_StatusText>
  <rt_AllActionsBitmap>0</rt_AllActionsBitmap>
  <rt_ActionStartTime>0</rt_ActionStartTime>
 </sbaactionstatus>
</root>

Scripting with REST

Basic Handler (PUT, POST, GET, DELETE)

...