Skip to content

pjabadesco/taskqueue-http

Repository files navigation

TECHNOLOGY

  • Redis
  • Celery
  • Celery Worker
  • Flower
  • MySQL
  • PHP
  • TaskGroups

LINKS

INSTALLATION

docker-compose build
docker-compose up

REQUEST: POST

{
    "taskname": "test-login",
    "url": "http://api/api.php?action=login",
    "http_method": "POST",
    "headers": {
        "Content-Type": "application/json"
    },
    "body": {
        "login": "admin",
        "password": "admin"
    },
    "callback_url": "http://api/callback.php?action=login"
}

RESPONSE:

{
    "message": "Task created successfully",
    "task_id": "06b650d4-8d21-4b20-ac8b-be62fc656997"
}

CALLBACK RESPONSE: POST

{
    "status":"success",
    "task_id":"b0c84268-f687-499d-998d-584985da9df0",
    "request":{
        "taskname":"test-login",
        "url":"http://api/api.php?action=login",
        "http_method":"POST",
        "body":{
            "login":"admin",
            "password":"admin",
            "session_id":"5aee3a7be4b4abc9a063b799cf8b8244"
        },
        "headers":{
            "Content-Type":"application/json",
            "X-TASK-ID":"b0c84268-f687-499d-998d-584985da9df0"
        },
        "callback_url":"http://api/callback.php?action=login"
    },
    "response":{
        "headers":{
            "Content-Type":"application/json",
            "X-TASK-ID":"b0c84268-f687-499d-998d-584985da9df0"
        },
        "status_code":200,
        "body":{
            "status":"success",
            "message":"Your credentials are valid. Please wait while we setup your login session.",
            "session_id":"5aee3a7be4b4abc9a063b799cf8b8244"
        }
    }
}

TEST: CURL REQUESTS - SUCCESS

curl --location --request POST 'http://localhost:8888' \
--header 'Content-Type: application/json' \
--data-raw '{
    "taskname":"test-login",
    "url":"http://api/api.php?action=login",
    "http_method":"POST",
    "body":{
        "login":"admin",
        "password":"admin",
        "session_id":"5aee3a7be4b4abc9a063b799cf8b8244"
    },
    "headers":{
        "Content-Type":"application/json"
    },
    "callback_url":"http://api/callback.php?action=login"
}'

TEST: CURL REQUESTS - FAIL

curl --location --request POST 'http://localhost:8888' \
--header 'Content-Type: application/json' \
--data-raw '{
    "taskname":"test-fail",
    "url":"http://fail.test",
    "http_method":"POST",
    "body":{
        "login":"admin",
        "password":"admin",
        "session_id":"5aee3a7be4b4abc9a063b799cf8b8244"
    },
    "headers":{
        "Content-Type":"application/json"
    },
    "callback_url":"http://api/callback.php?action=login"
}'

REFERENCES

KNATIVE