API Dokümantasyonu

Stocapi Kargo REST API V1.0 Dokumantasyonu

API'nin amacı Stocapi'nin kargo servisi için oluşturulmuştur. Tek bağlantı noktasından kargo firmaları ile iletişim sağlanmaktadır. Kargo Firmları:
API bağlantısı email ve password ile basic auth ile yapılır. aynı bilgiler Body ile de gönderilebilir. Alınan token ile istek yapılabilir.

Kullanıcı Girişi

POST /api/login

Request:

                    
                        

Authorization: Basic eyJ0eXAiOiJKV1QiLCJhbGciOiJIU...

Content-Type: application/json

{ "email":"ornek@mail.com", "password":"123456789" }

Response:

                    
                        

Status Code: 200

Content-Type: application/json

Data:

{ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIU...", "message": "success" }

Kargo Durumu Sorgulama

POST /api/cargo-inf

Request:

                    
                        

Authorization: Bearer {token}

Content-Type: application/json

{ "process_number":"8948620361685", "account_id":"123131322", "pay_on_delivery_amount":"0", "cargo_company_id":"9d6aab17-9b47-48a1-a859-e614edf2f372" }

Response:

                    
                        

Status Code: 200

Content-Type: application/json

Data:

{ "data": { "sender": { "location_name": "ADO* * * * * * * * * * ", "phone": "+90* * * * * * *", "country": "", "city": "", "district": "", "neighborhood": "", "postal_code": "", "address": "CEV* * * * * *" }, "receiver": { "name": "MEL* * * * * * * * * *", "phone": "5353* * * * * *", "email": "", "country": "", "city": "NİĞDE", "district": "MERKEZ", "neighborhood": "", "postal_code": "", "address": "KİL* * * * * *" }, "cargo_info": { "desi": "2", "situation": "Teslim Edildi", "status": 12, "cargo_accept_date": "2024-11-01", "ref_barcode": "540967300130", "collection": "989,00" }, "shipment_movements": [ { "carrier_barcode": "540967300130", "situation": "Kabul Edildi", "datetime": "2024-11-01 16:37:43", "location": "ADR-...", "explain": "Paket Kabulü Yapıldı", "responsible": { "name": "", "phone": "", "email": "" }, "created_at": "" }, { "carrier_barcode": "540967300130", "situation": "Normal", "datetime": "2024-11-01 17:01:12 17:01:12", "location": "DURSUNBEY", "explain": "Torbaya Eklendi", "responsible": { "name": "", "phone": "", "email": "" }, "created_at": "" }, { "carrier_barcode": "540967300130", "situation": "Normal", "datetime": "2024-11-06 10:08:29 10:08:29", "location": "NİĞDE", "explain": "Gönderinin Geliş Kaydı Yapıldı", "responsible": { "name": "", "phone": "", "email": "" }, "created_at": "" }, { "carrier_barcode": "540967300130", "situation": "Normal", "datetime": "2024-11-06 12:06:47 12:06:47", "location": "NİĞDE", "explain": "Köy Dağıtımına Tabi Bekliyor", "responsible": { "name": "", "phone": "", "email": "" }, "created_at": "" }, { "carrier_barcode": "540967300130", "situation": "Normal", "datetime": "2024-11-08 09:10:14 09:10:14", "location": "NİĞDE", "explain": "Dağıtıcıya Verildi", "responsible": { "name": "", "phone": "", "email": "" }, "created_at": "" }, { "carrier_barcode": "540967300130", "situation": "Teslim", "datetime": "2024-11-08 20:04:24 20:04:24", "location": "NİĞDE", "explain": "Alıcıya Teslim Edildi", "responsible": { "name": "", "phone": "", "email": "" }, "created_at": "" } ] } }

Kargo Ekleme

POST /api/send-cargo

Request:

                    
                        

Authorization: Bearer {token}

Content-Type: application/json

{ "cargo_company_id": "4882abaa-7695-423b-95c3-5da99893eb91", "service":"F", "process_number":"5858585858599", "account_id":"465465465456", "sender": { "name": "ADOREL LOJİSTİK KARGO A.Ş.", "contact_name":"Ferhat GÖlge", "country": "Türkiye", "country_code":"TR", "city": "İstanbul", "city_code":"34", "district": "Kadıköy", "district_code":"5465", "neighborhood": "Moda", "phone": "+905555555555", "email":"ferhatgolge@gmail.com", "address": "Gönderici adresi burada.", "address_id": "ARL", "shipment_options": "Hızlı Kargo", "code":"ARL", "accounting_id":"ARL", "abbreviation_code":"17996529", "vkn":"ARL", "postal_code":"34744" }, "receiver": { "receiver_id":"9d6aab2a-8ca6-4e7b-ae2f-57a963cce7db", "name": "Alıcı Adı", "contact_name":"", "country": "Türkiye", "country_code":"DE", "city": "Berlin", "city_code":"34", "district": "Mitte", "district_code":"5465", "neighborhood": "HauptstraBe", "address":"HauptstraBe 123 ", "email":"ferhatgolge@gmail.com", "phone": "+905555555556", "postal_code": "10115" }, "description": "Bu kargonun açıklaması.", "packages": [ { "width": 0, "height": 0, "length": 0, "desi": 3, "weight": 4, "quantity": 2 }, { "width": 14.2, "height": 16, "length": 25, "desi": 0, "weight": 2, "quantity": 1 } ], "pay_on_delivery_amount":"2500.00", "product_description":"adas", "product_currency":"USD", "pay_on_delivery_type":"1", "desi":"1.5", "quantity":"1", "pick_up_date":"16.11.2024", "delivery_slot_original":"0", "delivery_date_original":"24.11.2024", "export": { "custom_type": "Gümrük Tipi", "declaration_type": "M", "payment_method": "Ödeme Şekli", "vat_no": "TR1234567890", "eori_no": "EORI123456", "ioss_no": "IOSS123456", "pay_type":"P" }, "cargo_products": [ { "quantity":"2", "description":"asdasd", "price":"123", "hs_code":"8504.40.9000", "unit":"PCS", "stock_code":"1212", "currency":"12", "origin":"TR" } ], "invoice": { "invoice_no": "FTR20240001", "invoice_date": "2024-11-07", "invoice_amount": 125.25, "currency": "TRY", "einvoice_no": "EFTR20240001", "einvoice_date": "2024-11-07", "invoice_link": "http://example.com/invoice.pdf", "einvoice_link": "http://example.com/einvoice.pdf", "yarchive_pdf": "http://example.com/archive.pdf" }, "invoice_additional": { "name":"fff", "title":"fff", "phone":"5645", "email":"ferhatgolge@gmail.com", "address":"asd asdasd", "postal_code":"46546", "country_code":"TR", "city":"paris" } }

Response:

                    
                        

Status Code: 200

Content-Type: application/json

Data:

{ "data": { "code": 500, "out_tracking_code": "", "record_id": 0, "request": "eyJjdXN0b21lciI6IkFsXHUwMTMxY1....", "response": "ewogICAgImNvZGUiOiAiMjA3I.....", "message": [ "county_name(*) - İlçe alanı geçersizdir. Geçerli bir ilçe giriniz.", "district(*) - Mahalle alanı geçersizdir. Geçerli bir mahalle giriniz.", "Mahalle girilen ilçeye bağlı değil.", "Girilen ilçe ile ilin bağlantısı bulunamadı" ] } }

Kargo İptal

POST /api/cargo-remove

Request:

                    
                        

Authorization: Bearer {token}

Content-Type: application/json

{ "process_number":"5858585858599", "account_id":"12321313", "cargo_company_id":"eb5be433-2a1a-11ef-8d80-00505692173c" }

Response:

                    
                        

Status Code: 200

Content-Type: application/json

Data:

{ "data": { "code": 500, "out_tracking_code": "", "record_id": "12321313", "request": "eyJzdGF0dXMi9..", "response": "eyJzdGF0d...", "message": [ "5400397208 silinemedi! Hareket gormus." ] } }

Müşteri Bilgisi Kaydetme

POST /api/create-cargo-company

Request:

                    
                        

Authorization: Bearer {token}

Content-Type: application/json

{ "cargo_company_id":"9d6aab17-9b47-48a1-a859-e614edf2f372", "name": "Adorel-Test", "abbreviation_code": "ADO", "account_id": "ADO-12345", "contact_emails": "adorel@adorel.com.tr", "VKN": "1234567890", "sender_company_address_id": "ADOREL_001", "sender_country_name": "Türkiye", "sender_city_name": "İstanbul", "sender_town_name": "Kadıköy", "sender_district_name": "Moda", "sender_address_line": "Gönderici adresi burada.", "sender_phone":"05445136508", "recipient_company_address_id": "ADOREL_002", "recipient_country_name": "Türkiye", "recipient_city_name": "Ankara", "recipient_town_name": "Çankaya", "recipient_district_name": "Bahçelievler", "recipient_address_line": "Alıcı adresi burada." }

Response:

                    
                        

Status Code: 200

Content-Type: application/json

Data: