+39 02 456 7391 info@chemparser.com

API Resource Documentation

Login

Method to login and receive the token.

Method
POST
Endpoint
/parser/login
Description

Call this POST endpoint with a JSON body with the keys “username” and “password“.

If successful, returns a JSON with the key “token” and the relative token. The token has a validity of 1 hour.

If not successful, returns an HTTP status other than 200.

Send

Methods to send pdf.

Method
POST
Endpoint
/parser/uploadPdf
Description

Call this POST endpoint with a JSON body with three keys: “file“, “filename” and “bucket“.

  • file” has as value a string with the base64 of your pdf
  • filename” has as value a string with the name of the file
  • bucket” has as value a string that represent the place where your pdf will be stored.

In headers as key use “token” and as value use the token that you receive with the login method.

If successful, returns a JSON with three keys:

  • bucket” with the bucket chosen
  • filename” with the filename chosen
  • request_id” that is the 16-digit numeric unique identifier of the pdf sent.

If not successful, returns an HTTP status other than 200.

Method
POST
Endpoint

/parser/uploadFile

Description

Call this POST endpoint with a form-data request, use as key the word “file” and attach the pdf file to send.

In Query Parameters use as key the word “bucket” and as value a string that represent the place where your pdf will be stored.

In headers as key use “token” and as value use the token that you receive with the login method.

If successful, returns a JSON with three keys:

  • bucket” with the bucket chosen
  • filename” with the filename chosen
  • request_id” that is the 16-digit numeric unique identifier of the pdf sent.

If not successful, returns an HTTP status other than 200.

Get

Methods to receive the results.

Method
GET
Endpoint

/parser/getFile

Description
Call this GET endpoint with two Query Parameters: “request_id” and “content_type“.

  • request_id” is the 16-digit numeric unique identifier of a pdf previously sent
  • content_type” is the Content-Type that you want to receive: choose as value between “json” or “xml”.

In headers as key use “token” and as value use the token that you receive with the login method.

If successful, returns a JSON with one key “file” with as value a string that is the base64 of your results in the chosen content type.

If not successful, returns an HTTP status other than 200.

Method
GET
Endpoint

/parser/getContent

Description

Call this GET endpoint with two Query Parameters: “request_id” and “content_type“.

  • request_id” is the 16-digit numeric unique identifier of a pdf previously sent
  • content_type” is the Content-Type that you want to receive: choose as value between “json” or “xml“.

In headers as key use “token” and as value use the token that you receive with the login method.

If successful, returns a JSON with all the keys and the relative values of your results in the chosen content type.

If not successful, returns an HTTP status other than 200.

Info

Methods to receive informations about your SDSs and your buckets.

Method
GET
Endpoint
/parser/getStatus
Description
Call this GET endpoint with one Query Parameter: “request_id“.

request_id” is the 16-digit numeric unique identifier of a pdf previously sent.

In headers as key use “token” and as value use the token that you receive with the login method.

If successful, returns a JSON with two keys: “status” and “description“.

  • status” has as value a string of one possible status of your request_id pdf (received, processed, quality check, ready)
  • description” has as value a string that describe the status associated.

If not successful, returns an HTTP status other than 200.

Method
GET
Endpoint

/parser/getBucketTrees

Description
Call this GET without any additional Query Parameter.

In headers as key use “token” and as value use the token that you receive with the login method.

If successful, returns a JSON with two keys: “bucket_names” and “number_of_buckets“.

  • bucket_names” has as value a list of string with all the names of buckets where pdf are been sent
  • number_of_buckets” has the total number of buckets as its value

If not successful, returns an HTTP status other than 200.

Method
GET
Endpoint

/parser/getBucketInfo

Description
Call this GET endpoint with one Query Parameter: “bucket“.

bucket” has as value a string with the bucket whose information you want to receive.

In headers as key use “token” and as value use the token that you receive with the login method.

If successful, returns a JSON with three keys: “number_sds“, “ratio_ready” and “status“.

  • number_sds” has as value the number of SDSs in the bucket
  • ratio_ready” has as value the rounded percentage of the number of SDSs that have status ready
  • status” has as value a section which in turn contains as keys the various states of the SDSs present in the bucket and the relative value is the number of SDSs with a certain status.

If not successful, returns an HTTP status other than 200.

Method
GET
Endpoint

/parser/getInfoDownload

Description
Call this GET endpoint with one Query Parameter: “bucket“.

bucket” has as value a string with the bucket whose information you want to receive.

In headers as key use “token” and as value use the token that you receive with the login method.

If successful, returns a JSON with a list that contains three sections.

In the first section there are two keys: “downloaded” and “not_downloaded“.

  • downloaded” has as value the number of SDSs already downloaded
  • not_downloaded” has as value the number of SDSs not downloaded.

In the second section there is one key: “ratio_downloaded“.

  • ratio_downloaded” has as value the rounded percentage of the number of SDSs that have been downloaded.

In the third section there are as keys the 16-digit numeric unique identifiers that correspond to the SDSs in the specified bucket.

Each unique identifier has a sub-section with three keys: “downloaded”, “date”, and “msg”.

  • downloaded” has as value “yes” or “no
  • date” has as value (if the results has been downloaded) the date the results were downloaded
  • msg” has as value a message relative at the possibility that certain results could be download or not

bucket“, “filename” and “request_id” that is the 16-digit numeric unique identifier of the pdf sent.

If not successful, returns an HTTP status other than 200.

Alternatively you can call this GET method with the Query Parameter “request_id” with the 16-digit unique identifier as its value if you want information on the download status of a single sds (in this case it provides only the third section).

Comment

Method to send a comment relative to a SDS to the factory.

Method
POST
Endpoint
/parser/sendComment
Description
Call this POST endpoint with a JSON body with one key: “comment“.

comment” has as value a string with a comment, relative to a specific pdf, that you want to send to the Chemparser factory.

In Query Parameters use as key “request_id” and as value the 16-digit numeric unique identifier of a pdf previously sent.

In headers as key use “token” and as value use the token that you receive with the login method.

If successful, returns a JSON with one key: “msg“. “msg” has as value a string that inform you that the comment was sent.

If not successful, returns an HTTP status other than 200.