How can I take a picture with ISAPI Protocol

Tanner

n3wb
Sep 1, 2023
6
0
Germany
Hi there,

I am very new to this forum and need your help.

I wanted to implement an external solution using the ISAPI protocol to take a current image from the HIK vision and save it to a specified location.
Of course, I also need to know under which name and in which path the image was saved in order to store this information in the external application.
Is this possible at all?

Does anyone can show me a place, wehre I can download the documentation?

Thank you really very much and have a nice day.

Tanner
 
 
I wanted to implement an external solution using the ISAPI protocol to take a current image from the HIK vision and save it to a specified location.
Of course, I also need to know under which name and in which path the image was saved in order to store this information in the external application.
Is this possible at all?
This the extent of my knowledge regarding the Hikvision API:

Snapshot using HTTP URL:

http://<IP address of IPC>:<HTTP port>/Streaming/channels/1/picture
To include authentication:
http://<username>:<password>@<IP address of IPC>:<HTTP port>/Streaming/channels/1/picture

NOTES:
If the HTTP port is still the default 80 then it can be omitted from the above URL.
Also, not sure how to have it save to your specified location.
 
Great! Thank you.
What response do you get from the API? Is in the response the location of the saved picture and the name of the file?
 
Great! Thank you.
What response do you get from the API? Is in the response the location of the saved picture and the name of the file?
If entered from a browser I believe the response is a displayed JPEG file.

I ran across something before while looking into this that may be more like what you're looking for, let me try to locate it.
 
  • Like
Reactions: Tanner
If entered from a browser I believe the response is a displayed JPEG file.

I ran across something before while looking into this that may be more like what you're looking for, let me try to locate it.
Sorry, unable to locate any further info re: Hikvision snapshot API
 
There isnt one. For storing image is not really related to hikvision API(only mentioned when getting data from storage aka downloading), therefor implement saving solution as u can. One way can be using C# like i did here:

1693810637614.png
1693810612614.png

If you will use async method then File.WriteAllBytesAsync

You specify location and name yourself. Could be Cameraname_timestamp.jpg


declare camera names depending on IP address or fetch deviceInfo
timestamp can be used in a way DateTime.Now() in POST request to fetch image method.
 
  • Like
Reactions: TonyR and Tanner
Thank you! I would like to test it out but need a camera, which supports isapi. Do anybody know, where I can find a cam?
I have searched hole amazon and other shops but no one can give me the info, which cam supports ISAPI.
Br
Tanner
 
Tell me what exactly what do you need, like do you want to save image on event or simply call snapshot and have it saved to some directory or what?
 
My client buys goods from his customers. When he creates an invoice, he wants to be able to take a picture of the goods so that he can attach this picture to the created invoice. He has installed a very good and expensive HIK Vision IP cam and wants to use this camera for the pictures.
So my application should fulfill the following requirements:
  1. My application should have a button for taking pictures
  2. When click on the button a picture should be taken with the IP cam and attached to the invoice
  3. I don't want to save the whole image to keep the size of the database small. Instead, I want to save only the reference to the image in the app so that I can open the image from the IP Cam location.

    For this reason, I should know where this image was saved. Because I would take the location and the name (or ID) of the image and save it in the invoice

    Sorry for the confusion and thanks a lot for your help.

    /tanner
 
What about this short code I wrote
1693896635032.png

On browse you select desired folder, and when i press SNAPSHOT it will save the image from camera using YYYY-MM-DD_HH-MM-SS,jpg

Also a grid view of your saved images, aswell imagebox containing lastly snapshotted image

Gridbox contains ID,imagename and path you can copy



Edited: Noticed i didnt sort datatable descending, but it can be done really fast
 
Last edited:
  • Like
Reactions: paulpeter
I mean this can be upgraded to add lets say mysql database, where each data from grid will be stored in db. Then you can have the history of data. This way its only until u close the application.

Also it can be modified to support taking snapshots from multiple cameras and having imagename contain camera name. But it all depends on requirements.
 
Last edited:
  • Like
Reactions: Tanner
hi,
sorry for my answering late.
yes, It would be very helpful for me.
thank you so much.
I appreciate that.

greetings from germany.
Tanner
 
Make a github acc and send me pm with an email, i will grant you access to repository @Tanner Then you can edit stuff to suit your needs and not start from scratch.


Once you send me email just copy link from repository and clone it.

Also install VS2022 community edition if you dont have it. and all C# related frameworks.
 
execuse me, i want to ask how to add code for --> Digest Auth when request API snapshot in visual c#, thanks


C#:
CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(new Uri(url), "Digest", new NetworkCredential(username, password));

using var httpClientHandler = new HttpClientHandler
{
    Credentials = credentialCache
};

using var httpClient = new HttpClient(httpClientHandler);

.... Continue with GET POST PUT