Is the Nx Cloud up? Visit our Status Page for the current health and performance of the Nx Cloud.

Status Page

Add camera via Wisenet WAVE API

Answered

Comments

5 comments

  • Norman
    • Network Optix team

    Hi @...,

    Please, also include the username and password of the camera.
    For a single camera, your request might look like this when you use the api/manualCamera/search

    https://localhost:7001/api/manualCamera/search?url=<cameraIp>&user=<username>&password=<password>

    This should give the following output:

    {
      "error": "0",
      "errorString": "",
      "reply": {
        "cameras": [],
        "processUuid": "{ce46ee9f-8427-4a66-8a78-30ef343e98aa}",
        "status": {
          "current": "10",
          "state": 2,
          "total": "100"
        }
      }
    }
    1
  • Permanently deleted user

    i want to add camera into my server
    after manualCamera/search i must to run 
    https://localhost:7001/api/manualCamera/add?user=<username>&password=<password>&cameras[uniqueId]=30dab39e-c053-4ad3-bf80-2d23af1b4690&cameras[url]=<cameraIp>&cameras[manufacturer]=3100

    0
  • Norman
    • Network Optix team

    Hi @...,

    Please take notice of the following support article: <<<LINK>>>

    This covers your question and should provide the answer.

     

    0
  • Permanently deleted user

    Sorry but it isn't working, i doing query this query

    curl --location --request POST 'https://localhost:7001/api/manualCamera/add' \

    --header 'Connection: keep-alive' \

    --header 'Cache-Control: max-age=0' \

    --header 'sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"' \

    --header 'sec-ch-ua-mobile: ?0' \

    --header 'Upgrade-Insecure-Requests: 1' \

    --header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36' \

    --header 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \

    --header 'Sec-Fetch-Site: same-origin' \

    --header 'Sec-Fetch-Mode: navigate' \

    --header 'Sec-Fetch-User: ?1' \

    --header 'Sec-Fetch-Dest: document' \

    --header 'Referer: https://localhost:7001/static/api.xml' \

    --header 'Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7' \

    --header 'Cookie: x-runtime-guid=3030a97a-8593-4e07-8cae-62044aaa1ac9' \

    --header 'Content-Type: application/json' \

    --data-raw '{"user":"<username>","password":"<password>","cameras":[{"uniqueId":"31499389-2a83-4556-a56d-14e80861509d","url":"<cameraUrl>","manufacturer":"3100"}]}'
    0
  • Norman
    • Network Optix team

    Hi @...,

    Thank you for the challenge. ;-)

    My curl attempts stranded on an unknown error path, but my genius colleague Andrey Terentyev created a script for you, you can use to fulfill your needs in Bash.

    Here is the script and modify it to your liking:

    #!/bin/bash

    function usage()
    {
    echo "add_camera.sh adds a camera to a server"
    echo
    echo "Syntax: add_camera.sh <vms_user:vms_pass@server_ip> <camera_user:camera_pass@camera_ip>"
    }

    if [ $# -lt 2 ]
    then
    echo "Not enough parameters"
    usage
    exit
    fi

    server_creds=${1}
    camera_creds=${2}

    vms_server=`echo $server_creds | cut -d "@" -f 2`
    vms_user=`echo $server_creds | cut -d "@" -f 1| cut -d ":" -f 1`
    vms_pass=`echo $server_creds | cut -d "@" -f 1| cut -d ":" -f 2`

    camera_ip=`echo $camera_creds | cut -d "@" -f 2`
    camera_user=`echo $camera_creds | cut -d "@" -f 1 | cut -d ":" -f 1`
    camera_pass=`echo $camera_creds | cut -d "@" -f 1 | cut -d ":" -f 2`

    api_method="api/manualCamera/search"

    response=`curl -k --digest "https://$vms_user:$vms_pass@$vms_server:7001/$api_method?url=$camera_ip&user=$camera_user&password=$camera_pass"`

    #echo $response

    uuid=`echo $response | cut -d ":" -f 6 | cut -d "," -f 1 | sed -e 's/.*{\(.*\)}.*/\1/'`
    #echo $uuid

    sleep 5

    api_method="api/manualCamera/status"

    response=`curl -k --digest "https://$vms_user:$vms_pass@$vms_server:7001/$api_method?uuid=$uuid"`

    echo $response

    IFS=',' read -ra values <<< "$response"

    for v in "${values[@]}"
    do
    if echo $v | grep -q "manufacturer"
    then
    manufacturer=$v
    elif echo $v | grep -q "uniqueId"
    then
    uniqueId=$v
    elif echo $v | grep -q "url"
    then
    url=$v
    fi
    done

    user_json='{
    "user":"'$camera_user'",
    "password":"'$camera_pass'",
    "cameras":[{'$manufacturer','$uniqueId','$url'}]
    }'

    api_method="api/manualCamera/add"

    echo $user_json | curl -k -X POST --digest "https://$vms_user:$vms_pass@$vms_server:7001/$api_method" -H "Content-Type: application/json" --data-binary @-

     

    0

Please sign in to leave a comment.