Bulk Load Example

  • task: Bulk load instances of relation/LineRelation/

  • user: provider administrator

  • hierarchy: 55b9daeca6165413b9d166de

  • Bulk load file: LineRelation.xlsx

Snippet of file to Bulk load: LineRelation.xlsx

# Hierarchy Node

# Device

# CFT Template

# Directory Number

# Alerting Name

sys.prov1.cust1. locus1

10.120.2.216, 8443, prov1.cust1

line-cft

90218

techsupport

sys.prov1.cust1. locus1

10.120.2.216, 8443, prov1.cust1

line-cft

90219

techsupport

sys.prov1.cust1. locus1

10.120.2.216, 8443, prov1.cust1

line-cft

90220

techsupport

sys.prov1.cust1. locus1

10.120.2.216, 8443, prov1.cust1

line-cft

90221

techsupport

sys.prov1.cust1. locus1

10.120.2.216, 8443, prov1.cust1

line-cft

90222

techsupport

Upload the file:

$ curl -v
       -H 'Authorization: Basic YWRtaW5AcHJvdjEuY29tOnBhc3N3b3Jk'
       -F uploadedfile='@LineRelation.xlsx'
       'http://localhost/api/uploadfiles/
        ?hierarchy=55b9daeca6165413b9d166de'* About to connect() to localhost port 80 (#0)
+   Trying 127.0.0.1... connected
> POST /api/uploadfiles/?hierarchy=55b9daeca6165413b9d166de HTTP/1.1
> Authorization: Basic YWRtaW5AcHJvdjEuY29tOnBhc3N3b3Jk
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu)
              libcurl/7.22.0
              OpenSSL/1.0.1
              zlib/1.2.3.4
              libidn/1.23
              librtmp/2.3
> Host: localhost
> Accept: */*
> Content-Length: 10455
> Expect: 100-continue
> Content-Type: multipart/form-data;
                boundary=----------------------------5a0f36378f19
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Server: nginx/1.1.19
< Date: Thu, 30 Jul 2015 15:09:25 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< Vary: Accept, Cookie, Accept-Language, X-CSRFToken
< Content-Language: en-us
< Allow: POST, OPTIONS
< X-CSRFToken: C4ceiFEWSbjif1O4Jzhr1gZV9ytd9f2F
< Set-Cookie: csrftoken=C4ceiFEWSbjif1O4Jzhr1gZV9ytd9f2F;
   SameSite=Lax;
   httponly;
   Path=/
< Set-Cookie: sessionid=07z03pbatb1qelahcc01ygufgzsr6i35;
   SameSite=Lax;
   httponly;
   Path=/
<
+ Connection #0 to host localhost left intact
+ Closing connection #0
{"uploadedfiles": [
  {"name": "LineRelation.xlsx",
  "id": "55ba3e25a616541bb906b209"}
 ]}

Bulk load the file:

$ curl -v
       -H 'Authorization: Basic YWRtaW5AcHJvdjEuY29tOnBhc3N3b3Jk'
       -H 'Content-Type: application/json'
       -H 'accept: application/json'
       --data-binary '{"bulkload_file":"LineRelation.xlsx",
                       "execute_immediately":true}'
       -X POST 'http://localhost/api/tool/BulkLoad/?
                hierarchy=55b9daeca6165413b9d166de
                &method=bulkload_spreadsheet
                &nowait=true
                &format=json'
+ About to connect() to localhost port 80 (#0)
+ Trying 127.0.0.1... connected
> POST /api/tool/BulkLoad/
       ?hierarchy=55b9daeca6165413b9d166de
       &method=bulkload_spreadsheet
       &nowait=true
       &format=json HTTP/1.1
> Authorization: Basic YWRtaW5AcHJvdjEuY29tOnBhc3N3b3Jk
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu)
              libcurl/7.22.0
              OpenSSL/1.0.1
              zlib/1.2.3.4
              libidn/1.23
              librtmp/2.3
> Host: localhost
> Content-Type: application/json
> accept: application/json
> Content-Length: 64
>
+ upload completely sent off: 64out of 64 bytes
< HTTP/1.1 202 ACCEPTED
< Server: nginx/1.1.19
< Date: Thu, 30 Jul 2015 14:51:22 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept, Cookie, Accept-Language, X-CSRFToken
< Content-Language: en-us
< Allow: GET, POST, HEAD, OPTIONS
< X-CSRFToken: iFh5q8FUBxoXyyiLcELHoO8W5IDFbAiP
< Set-Cookie: csrftoken=iFh5q8FUBxoXyyiLcELHoO8W5IDFbAiP;
              httponly;
              Path=/
< Set-Cookie: sessionid=3ayny2y73i43u6sj9bdyoawhhtr8wbm8;
              httponly;
              Path=/
<
+ Connection #0 to host localhost left intact
+ Closing connection #0
{"href": "/api/tool/Transaction/16e1e599-494a-4898-944a-0528915d2f42/",
 "success": true,
 "transaction_id": "16e1e599-494a-4898-944a-0528915d2f42"}