Instructions on how to GET, POST, PATCH and DELETE requests
-
Hello to all
I am developing a website here: https://melimpampa.gr/NEWSITE/ where I need to have GET, POST, PATCH and DELETE requests to API. I don’t know if I sate this correctly.
The way that this should work is described as follows:
Connecting to Epsilon Office
To connect to Epsilon Office and be able to see the results of the requests you send, you must use the following information.
URL : https://test.office.epsilon.software
Username : 046717354-eshop
Password : Esh0p123$!
Connecting to Epsilon Office
Connecting to Epsilon Office is done through our API, where you can send GET, POST, PATCH and DELETE requests. When a request is successfully executed, you will be returned the HTTP success status 200. Otherwise, you will be returned another status code with a message, depending on the error.
Authentication
To authenticate the requests, you must add as a header to each request the api-key: <api-key>, which is provided by us and corresponds to an Epsilon Office user.
The API KEY you will use will be different for each ESHOP, so you will need to save it as a setting. The same applies to the BASE URL, which is listed below and you will also need to save it as a setting.
To implement the interface and test the functionalities, you can use the following elements.
BASE URL : https://test.office.epsilon.software
API KEY : 8a887d236ba747046cee25f868672d6d161f8d0c12f36c5cc6fabf215a599439
Create an Order
To create an order, a POST request must be made to the following endpoint.
{BASE_URL}/api/v3/node/parastatiko
The body that should be given in the POST request must be JSON, corresponding to the template that you can find in the attachments.
In most fields present in JSON, there are indicative values and they should change depending on the order.
Upon successful execution of the request, the details of the document created in Epsilon Office are returned as a response.
Order Update
When you need to update a field of the order in Epsilon Office, you should make a PATCH request giving the order ID and not POST, as the POST request creates a new order. Therefore, you should save the order ID somewhere when creating it, where it is returned in the response and is the id field.
The endpoint for the PATCH request is the following.
{BASE_URL}/api/v3/node/parastatiko/<id>
where <id> is the id of the document we want to update.
In the PATCH request, you can send as a body the same fields and details that you send in the POST, nothing changes, it simply updates and not creates like POST.
Delete Order
To delete an order, you must make a DELETE request and use the following endpoint.
{BASE_URL}/api/v3/node/parastatiko/<id>
where <id> is the id of the order we want to delete.
Retrieve Order Details
To retrieve the details of an order, you must make a GET request and use the following endpoint.
{BASE_URL}/api/v3/node/parastatiko/<id>
where <id> is the id of the order we want to get the details of.Now the information that I should send should be in a json file format and are:
{
"field_synallassomenos_paras": {
"id": "[email protected]",
"field_rolos_synallassomenoy": "pelaths",
"field_onomasia": "Test Name",
"field_odos": "Test Address 1",
"field_perioxh": "Test Area",
"field_tk": "123456",
"field_xvra": "GR",
"field_e_email": "[email protected]",
"field_thlefvno_kinhto": "1234567890",
"field_eidos_synallassomenoy": "eshop"
},
"field_kyklvma": "paraggelies",
"field_katastash_parastatikoy": {
"id": "For Example, on-hold",
"name": "For Example, On hold",
"field_woocommerce_id": "For example on-hold"
},
"field_seira_parastatikoy": "seira_paraggelias_eshop",
"field_tropos_apostolhs": "FEDEX",
"field_tropos_plhrvmhs": "COD",
"field_topos_paradoshs": "Way of Delivery",
"field_parathrhseis": "Order Comments. ",
"field_aitiologia": "Order Comments.",
"field_hmeromhnia_parastatikoy": "2023-05-19",
"field_hmeromhnia_kataxvrhshs_par": "2023-05-19 13:16:04",
"field_hmeromhnia_ekdoshs": "2023-05-19 13:16:04",
"field_ypologismos_sthn_apouhkeys": true,
"field_kinhsh_par_r": [
{
"field_eidos_r": {
"id": "3H1T651J92Z-0100-XL",
"field_onomasia": "Product Test",
"field_basikos_kvdikos": "3H1T651J92Z-0100-XL",
"field_timh_lianikhs": 100
},
"field_posothta": 1,
"field_timh_monadas": 100,
"field_ypologismos_sthn_apouhkeys": true
}
],
"field_kleidi_eshop": 99999,
"field_ariumos_parastatikoy": 99999,
"field_apouhkeytikos_xvros": "eshop"
}I tried using GET and I had the following configuration that gets the info from the EPSILON office:
When I select Test Endpoint I get Success message:
The truth is that I don’t understand some of the fields like Query String, and I cannot figure out how I need to set up the parametrization so that I get the fields id, field_rolos_synallassomenoy, field_onomasia, field_odos, field_perioxh, field_tk, field_xvra etc under field_synallassomenos_paras.
I am really confused.
Is there anybody that can help on this?
Thanks in advance
George
The page I need help with: [log in to see the link]
You must be logged in to reply to this topic.