Images

Optionally, you can use an image to graphically represent the digital signature within a signed document. To do this, you need to upload your signature image to One-Shot Optimizer through an API call. One-Shot Optimizer will store your image and assign it a unique id, which can be later used to insert the image in the signed document as a graphical representation of the digital signature.

Verb Endpoint Action
POST /image Upload a new image
GET /image/{uid} Retrieve an image
DELETE /image/{uid} Delete an image
GET /images List all uploaded images
DELETE /images Delete all uploaded images

Upload a new image

Description

Upload an image

Endpoint

/api/v1/image

Method

POST

Parameters
Body Parameters
Parameter Description Mandatory
image The actual image to upload, in "png" format. Yes
Response

The response is a JSON object containing the uid assigned to the uploaded image. This unique identifier can be used to refer to the image in subsequent API calls.


                    {
                        "status": "200 OK",
                        "details": "bfd74f73-7b22-40a6-ad37-6fc867263309"
                    }
                
Errors

The server will reply with an error message if the file is not an actual image file:


                    {
                        "status": "415 Unsupported Media Type",
                        "details": "Image file type not supported"
                    }
                
Example
curl -H "Content-Type: multipart/form-data" -F "image=@test.png" -X POST https://oneshot.demo.uanataca.com/api/v1/image

                    {
                        "status": "200 OK",
                        "details": "97ca19b7-8d84-4b1b-8cd3-6a6f19b2600c"
                    }
                

Retrieve an image

Description

Retrieve a previously uploaded image

Endpoint

/api/v1/image/{uid}

Method

POST

Parameters
Path Parameters
Parameter Description
uid The uid of the image
Response

Returns the image in binary format.

Errors

If no image is found with the specified uid, a HTTP 404 error is returned:


                    {
                        "status": "404 Not Found",
                        "details": "Image not found"
                    }
                
Example
curl --output image.png -X GET https://oneshot.demo.uanataca.com/api/v1/image/97ca19b7-8d84-4b1b-8cd3-6a6f19b2600c
image.png:

                    %PNG
                    ...
                

List images

Description

List all uploaded images

Endpoint

/api/v1/images

Method

GET

Parameters

No parameters needed.

Response

Returns a list containing image uid and the associate information for each of them:


                    {
                        "status": "200 OK",
                        "details": {
                            "97ca19b7-8d84-4b1b-8cd3-6a6f19b2600c": {
                                "upload_date": "12/11/2019 17:59:05",
                                "ext": ".png",
                                "size": [
                                    692,
                                    433
                                ],
                                "mime": "image/png",
                                "filename": "test.png"
                            },
                            "b0b6370e-8b54-4d8b-ab6f-a002cf08dd28": {
                                "upload_date": "12/11/2019 16:42:07",
                                "ext": ".png",
                                "size": [
                                    692,
                                    433
                                ],
                                "mime": "image/png",
                                "filename": "document_front.png"
                            },
                            "62e96f29-41ae-4c67-bc3c-db850474dd09": {
                                "upload_date": "12/11/2019 16:42:09",
                                "ext": ".png",
                                "size": [
                                    692,
                                    433
                                ],
                                "mime": "image/png",
                                "filename": "document_back.png"
                            }
                        }
                    }
                
Example
curl -X GET https://oneshot.demo.uanataca.com/api/v1/images

                    {
                        "status": "200 OK",
                        "details": {
                            "4bf410bb-0e2d-44ed-8167-3d1cb7f9a07c": {
                                "upload_date": "12/11/2019 18:26:29",
                                "ext": ".png",
                                "size": [
                                    484,
                                    484
                                ],
                                "mime": "image/png",
                                "filename": "document_owner.png"
                            },
                            "a7a52145-9f58-4d20-8dd3-12c1fe9bd0ee": {
                                "upload_date": "12/11/2019 18:26:32",
                                "ext": ".png",
                                "size": [
                                    692,
                                    433
                                ],
                                "mime": "image/png",
                                "filename": "document_rear.png"
                            },
                            "ec3ac1a0-19ce-4176-a5a6-73eac9a93fc9": {
                                "upload_date": "12/11/2019 18:26:39",
                                "ext": ".png",
                                "size": [
                                    2160,
                                    1080
                                ],
                                "mime": "image/png",
                                "filename": "testimage.png"
                            }
                        }
                    }
                

Delete an image

Description

Delete a previously uploaded image.

Endpoint

/api/v1/image/{uid}

Method

DELETE

Parameters
Path Parameters
Parameter Description
uid The uid of the image
Response

Returns a JSON object with a successful message:


                    {
                        "status": "200 OK",
                        "details": "Image deleted"
                    }
                
Errors

A HTTP 404 error is returned if the specified image is not found:


                    {
                        "status": "404 Not Found",
                        "details": "Image not found"
                    }
                
Example
curl -X DELETE https://oneshot.demo.uanataca.com/api/v1/image/4bf410bb-0e2d-44ed-8167-3d1cb7f9a07c

                    {
                        "status": "200 OK",
                        "details": "Image deleted"
                    }
                

Delete all images

Description

Delete all uploaded images.

Endpoint

/api/v1/images

Method

DELETE

Parameters

No parameters needed.

Response

Returns a successful message if the documents are deleted:


                    {
                        "status": "200 OK",
                        "details": "Images deleted successfully"
                    }
                
Example
curl -X DELETE https://oneshot.demo.uanataca.com/api/v1/images

                    {
                        "status": "200 OK",
                        "details": "Images deleted successfully"
                    }