MiniCRM API pentru oferte
Informații necesare pentru autentificare
- ID-ul Sistemului – (sau SystemId) și este compus din maximum 5 cifre și îl găsești în adresa URL a contului MiniCRM și este afișat imediat după r3.minicrm.ro/ (sau r3.minicrm.io/ sau r3.minicrm.hu).
- Cheia API – (sau API Key) – cheia API poate fi generată din sistem de către un administrator. Pentru aceasta mergi la Setări – Sistem – Generează o nouă cheie API. Dacă s-a generat deja o cheie API, există posibilitatea de a genera o nouă cheie sau de a o șterge pe cea existentă.
MiniCRM API poate fi folosit printr-o conexiune securizată folosind prefixul https://.
Url-ul pentru API-ul pentru facturare este
https://SystemId:APIKey@r3.minicrm.hu/Api/Offer
Sistemul de codare al informațiilor
API-ul pentru facturare folosește UTF-8 și se așteaptă ca toți parametrii să fie codați în sistemul UTF-8. Răspunsul este oferit tot în sistem UTF-8.
Format
Input-ul și output-ul de date este întotdeauna sub forma unui array JSON serializat.
Adăugarea unei ofertei noi prin API
Poți adăuga o nouă ofertă prin API folosind un JSON ca în exemplul de mai jos:
{ "CustomerId": "40", "InvoicePadCounter": "00005", "Number": "OF2021-E/00005", "Type": "Offer", "Media": "PKI", "Language": "HU", "Customer":{ "Name": "teszt", "CountryId": "36", "County": "", "PostalCode": "1076", "City": "Budapest", "Address": "rwe", "AccountNumber": "", "VatNumber": "", "EUVatNumber": "", "RegistrationNumber": "", "GroupIdentificationNumber": "" }, "Vendor": { "Name": "Teszt", "CountryId": "36", "PostalCode": "1075", "City": "Smaragdvaros", "Address": "Sargakoves ut 1", "AccountNumber": "", "IBAN": "", "SWIFT": "", "VatNumber": "23982273-2-42", "EUVatNumber": "HU23982273", "GroupIdentificationNumber": "", "RegistrationNumber": "" }, "ExtraData": "", "Subject": "", "PaymentMethod": "WiredTransfer", "Issued": "2021-07-27", "Performance": "2021-07-27", "Prompt": "2021-07-27", "Paid": "", "CurrencyCode": "HUF", "ConversionRate": "", "AmountNet": "23.00", "AmountVat": "0.00", "Amount": "23.00", "VATMode": "NormalVAT", "Accounting": "Normal", "DocumentId": "6", "DocumentUrl": "https://r3-test.minicrm.eu/60793/Download/S3/?t=doc&inline=0&e=255hn6jnvg04i9p1u4l6", "Items": [ { "SKU": "", "EAN": "", "Name": "testr", "Description": "", "PriceNet": "23.0000", "Quantity": "1.00", "Unit": "darab", "PriceNetTotal": "23", "VAT": "KBAUK", "VATSubtype": "", "PriceTotal": "23.00" } ], "Project": { "String1616": "" } }
În cazul în care request-ul s-a finalizat cu succes, vei primi un răspund de forma:
{ "Id": "12", "InvoicePadCounter": "00006", "Number": "1awp_AJ2021-E/00006", "Type": "Offer", "Media": "PKI", "Language": "_HU", "Customer": { "Name": "teszt", "CountryId": "36", "County": "", "PostalCode": "1076", "City": "Budapest", "Address": "rwe", "AccountNumber": "", "VatNumber": "", "EUVatNumber": "", "RegistrationNumber": "", "GroupIdentificationNumber": "" }, "Vendor": { "Name": "Teszt", "CountryId": "36", "PostalCode": "1075", "City": "Smaragdvaros", "Address": "Sargakoves ut 1", "AccountNumber": "", "IBAN": "", "SWIFT": "", "VatNumber": "23982273-2-42", "EUVatNumber": "HU23982273", "GroupIdentificationNumber": "", "RegistrationNumber": "" }, "ExtraData": "", "Subject": "", "PaymentMethod": "WiredTransfer", "Issued": "2021-08-03", "Performance": "2021-08-03", "Prompt": "2021-08-03", "Paid": "", "CurrencyCode": "HUF", "ConversionRate": "", "AmountNet": "23.00", "AmountVat": "0.00", "Amount": "23.00", "VATMode": "NormalVAT", "Accounting": "Normal", "DocumentId": "8", "DocumentUrl": "https://r3-test.minicrm.eu/60793/Download/S3/?t=doc&inline=0&e=2h4ptdmlfm1jy72rartu", "Items": [ { "Id": "9", "SKU": "", "EAN": "", "Name": "testr", "Description": "", "PriceNet": "23.0000", "Quantity": "1.00", "Unit": "darab", "PriceNetTotal": "23", "VAT": "KBAUK", "VATSubtype": "", "PriceTotal": "23.00" } ], "Project": { "String1616": "", "StatusId": "3103" } }
Interogarea unei oferte
Poți obține detalii despre o anumită ofertă accesând un URL de genul:
https://SystemId:APIKey@r3.minicrm.hu/Api/Offer/10
Iar sistemul îți va returna:
{ "Id": "10", "InvoicePadCounter": "00005", "Number": "1awp_AJ2021-E/00005", "Type": "Offer", "Media": "PKI", "Language": "_HU", "Customer": { "Name": "teszt", "CountryId": "36", "County": "", "PostalCode": "1076", "City": "Budapest", "Address": "rwe", "AccountNumber": "", "VatNumber": "", "EUVatNumber": "", "RegistrationNumber": "", "GroupIdentificationNumber": "" }, "Vendor": { "Name": "Teszt", "CountryId": "36", "PostalCode": "1075", "City": "Smaragdvaros", "Address": "Sargakoves ut 1", "AccountNumber": "", "IBAN": "", "SWIFT": "", "VatNumber": "23982273-2-42", "EUVatNumber": "HU23982273", "GroupIdentificationNumber": "", "RegistrationNumber": "" }, "ExtraData": "", "Subject": "", "PaymentMethod": "WiredTransfer", "Issued": "2021-07-27", "Performance": "2021-07-27", "Prompt": "2021-07-27", "Paid": "", "CurrencyCode": "HUF", "ConversionRate": "", "AmountNet": "23.00", "AmountVat": "0.00", "Amount": "23.00", "VATMode": "NormalVAT", "Accounting": "Normal", "DocumentId": "6", "DocumentUrl": "https://r3-test.minicrm.eu/60793/Download/S3/?t=doc&inline=0&e=255hn6jnvg04i9p1u4l6", "Items": [ { "Id": "7", "SKU": "", "EAN": "", "Name": "teszt", "Description": "", "PriceNet": "23.0000", "Quantity": "1.00", "Unit": "darab", "PriceNetTotal": "23", "VAT": "KBAUK", "VATSubtype": "", "PriceTotal": "23.00" } ], "Project": { "String1616": "" } }
Modificarea statusului unei oferte:
Este nevoie să apelezi un URL ca în exemplul de mai jos:
https://SystemId:APIKey@r3.minicrm.hu/Api/Offer/OfferId/Project
Și să transmiți prin POST un JSON de genul:
{ "String1616": "Test", <== Se modifică un câmp de pe cardul ofertei "StatusId": "Emis" <== Statusul ofertei }
Crearea unei oferte prin fișier XML
Pentru a crea un card de ofertă prin XML Sync (poți găsi detalii pe pagina dedicată acestui subiect) este nevoie să ai un fișier de forma:
<?xml version="1.0" encoding="UTF-8"?> <Projects> <!-- Id = External ReferenceId [required int] --> <Project Id="99999"> <!-- Name of client. [required string] --> <Name>Test Company</Name> <!-- Webshop module MiniCRM id [required int] --> <CategoryId>39</CategoryId> <!-- Default status. Subscriber / Registered Other status are changed automatically [required string] --> <StatusId>Registered</StatusId> <!-- Owner of the offer [optional string] --> <UserId>102970</UserId> <!-- One Company or minimum one person is required --> <Business> <!-- More fields can be added to Company https://www.minicrm.io/help/xml-sync/#PldaXML --> <Name>Test Company</Name> <Emails> <Email> <Value>jambor.timea+ceg@minicrm.hu</Value> </Email> </Emails> </Business> <Contacts> <Contact> <!-- More fields can be added to Person https://www.minicrm.io/help/xml-sync/#PldaXML --> <FirstName>Test</FirstName> <LastName>Example</LastName> <Emails> <Email> <Value>jambor.timea+example@minicrm.hu</Value> </Email> </Emails> </Contact> </Contacts> <Offers> <!-- Id = External id of offer [required int] --> <Offer Id="99999"> <!-- Number of offer [required string] --> <Number>Offer_1</Number> <!-- CurrencyCode of offer [required string] --> <CurrencyCode>HUF</CurrencyCode> <!-- Prompt date of offer [required date] --> <Prompt>2021-09-30 12:15:13</Prompt> <!-- Performance date of offer [required date] --> <Performance>2021-09-30 12:15:13</Performance> <!-- Issued date of offer [required date] --> <Issued>2021-09-22 12:15:13</Issued> <!-- Description of offer [optional string] --> <Subject>Some note</Subject> <!-- Status of offer [required string]--> <Status>Accepted</Status> <!-- Data of Customer --> <Customer> <!-- Name of Customer [required string] --> <Name>Test Example</Name> <!-- Country of customer [required string] --> <CountryId>Hungary</CountryId> <!-- Postalcode of customer [required string] --> <PostalCode>1042</PostalCode> <!-- City of customer [required string] --> <City>Budapest</City> <!-- Address of customer [required string] --> <Address>Test Elek u. 94.</Address> </Customer> <!-- Data of product --> <Products> <!-- Id = External id of product [required int] --> <Product Id="11144"> <!-- Name of product [required int] --> <Name>First product</Name> <!-- SKU code of product [optional string] --> <SKU>ET-1234</SKU> <!-- EAN code of product [optional string] --> <EAN>1865489756485</EAN> <!-- Nett price of product [required int] --> <PriceNet>1250</PriceNet> <!-- Quantity of product [required int] --> <Quantity>5</Quantity> <!-- Unit of product [required string] --> <Unit>piece</Unit> <!-- VAT of product [required int] --> <VAT>27%</VAT> <!-- Folder of product in MiniCRM. If it does not exist, then it is created automaticly [required string] --> <FolderName>Default products</FolderName> </Product> </Products> </Offer> </Offers> </Project> </Projects>