Create a db table structure and functionality proposal for requests and responses and their temp files
1. DB structure
Adding new table marketplace_log
id | request_location | response_location | action_name | account_id | hash(index) | is_request_successful |
---|---|---|---|---|---|---|
INT(10) | VARCHAR(150) | VARCHAR(150) | VARCHAR(50) | INT(10) | VARCHAR(100) | TINY INT(1) |
- Functionality
All requests for current date will be stored in one text file and all responses for current date will be stored in another text file for one marketplace integration.
In the request file we will contain the endpoint, header information, access token and the body of the request. And the response file will contain the response headers, response body and HTTP code from the response.
The hash for one request and response will be the same. With the hash and search command the wanted payload could be accessed.
Example 1: sed -n '/##hash##/,/##hash##/p' request/response_location(value)
The search command can be modified to show only the wanted information without the hash strings:
Example 2: sed -n '/##hash##/,/##hash##/{/hash|hash/d;p}' request/response_location(value) - to get all request/response information;
Example 3: sed -n '/hash Endpoint/,/hash Endpoint/{/hash|hash/d;p}' request/response_location(value) - to get only Endpoint for example.
Note: for Example 3 possible values for partial retrieve information: HTTP method, Request headers, Request body, Token, Endpoint, HTTP code, Response headers, Response body.