Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- Adds the "Authorization: Bearer <access_token>" header.
EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Accept', 'application/json'
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://api-v2.fattureincloud.it/c/:company_id/company/info', @sbResponseBody
IF @success = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
RETURN
END
DECLARE @jResp int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @http, 'LastStatus', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)
-- {
-- "data": {
-- "id": "<integer>",
-- "name": "<string>",
-- "email": "<string>",
-- "type": "accountant",
-- "access_info": {
-- "role": "subaccount",
-- "permissions": {
-- "fic_situation": "read",
-- "fic_clients": "none",
-- "fic_suppliers": "none",
-- "fic_products": "read",
-- "fic_issued_documents": "write",
-- "fic_received_documents": "write",
-- "fic_receipts": "write",
-- "fic_calendar": "detailed",
-- "fic_archive": "detailed",
-- "fic_taxes": "read",
-- "fic_stock": "read",
-- "fic_cashbook": "write",
-- "fic_settings": "read",
-- "fic_emails": "none",
-- "fic_export": "detailed",
-- "fic_import_bankstatements": "none",
-- "fic_import_clients_suppliers": "none",
-- "fic_import_issued_documents": "read",
-- "fic_import_products": "write",
-- "fic_recurring": "none",
-- "fic_riba": "none",
-- "dic_employees": "none",
-- "dic_settings": "read",
-- "dic_timesheet": "read",
-- "fic_issued_documents_detailed": {
-- "quotes": "none",
-- "proformas": "write",
-- "invoices": "write",
-- "receipts": "write",
-- "delivery_notes": "detailed",
-- "credit_notes": "none",
-- "orders": "write",
-- "work_reports": "none",
-- "supplier_orders": "detailed",
-- "self_invoices": "detailed"
-- }
-- },
-- "through_accountant": "<boolean>"
-- },
-- "plan_info": {
-- "limits": {
-- "clients": "<integer>",
-- "suppliers": "<integer>",
-- "products": "<integer>",
-- "documents": "<integer>"
-- },
-- "functions": {
-- "archive": "<boolean>",
-- "cerved": "<boolean>",
-- "document_attachments": "<boolean>",
-- "e_invoice": "<boolean>",
-- "genius": "<boolean>",
-- "mail_tracking": "<boolean>",
-- "payment_notifications": "<boolean>",
-- "paypal": "<boolean>",
-- "receipts": "<boolean>",
-- "recurring": "<boolean>",
-- "smtp": "<boolean>",
-- "sofort": "<boolean>",
-- "stock": "<boolean>",
-- "subaccounts": "<boolean>",
-- "tessera_sanitaria": "<boolean>",
-- "ts_digital": "<boolean>",
-- "ts_invoice_trading": "<boolean>",
-- "ts_pay": "<boolean>"
-- },
-- "functions_status": {
-- "ts_digital": {
-- "active": "<boolean>"
-- },
-- "ts_pay": {
-- "active": "<boolean>"
-- }
-- }
-- },
-- "accountant_id": "<integer>",
-- "is_accountant": "<boolean>"
-- }
-- }
-- Sample code for parsing the JSON response...
-- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
DECLARE @Id nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Id OUT, 'data.id'
DECLARE @Name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Name OUT, 'data.name'
DECLARE @v_Email nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @v_Email OUT, 'data.email'
DECLARE @v_Type nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @v_Type OUT, 'data.type'
DECLARE @Role nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Role OUT, 'data.access_info.role'
DECLARE @Fic_situation nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_situation OUT, 'data.access_info.permissions.fic_situation'
DECLARE @Fic_clients nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_clients OUT, 'data.access_info.permissions.fic_clients'
DECLARE @Fic_suppliers nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_suppliers OUT, 'data.access_info.permissions.fic_suppliers'
DECLARE @Fic_products nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_products OUT, 'data.access_info.permissions.fic_products'
DECLARE @Fic_issued_documents nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_issued_documents OUT, 'data.access_info.permissions.fic_issued_documents'
DECLARE @Fic_received_documents nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_received_documents OUT, 'data.access_info.permissions.fic_received_documents'
DECLARE @Fic_receipts nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_receipts OUT, 'data.access_info.permissions.fic_receipts'
DECLARE @Fic_calendar nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_calendar OUT, 'data.access_info.permissions.fic_calendar'
DECLARE @Fic_archive nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_archive OUT, 'data.access_info.permissions.fic_archive'
DECLARE @Fic_taxes nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_taxes OUT, 'data.access_info.permissions.fic_taxes'
DECLARE @Fic_stock nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_stock OUT, 'data.access_info.permissions.fic_stock'
DECLARE @Fic_cashbook nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_cashbook OUT, 'data.access_info.permissions.fic_cashbook'
DECLARE @Fic_settings nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_settings OUT, 'data.access_info.permissions.fic_settings'
DECLARE @Fic_emails nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_emails OUT, 'data.access_info.permissions.fic_emails'
DECLARE @Fic_export nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_export OUT, 'data.access_info.permissions.fic_export'
DECLARE @Fic_import_bankstatements nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_import_bankstatements OUT, 'data.access_info.permissions.fic_import_bankstatements'
DECLARE @Fic_import_clients_suppliers nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_import_clients_suppliers OUT, 'data.access_info.permissions.fic_import_clients_suppliers'
DECLARE @Fic_import_issued_documents nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_import_issued_documents OUT, 'data.access_info.permissions.fic_import_issued_documents'
DECLARE @Fic_import_products nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_import_products OUT, 'data.access_info.permissions.fic_import_products'
DECLARE @Fic_recurring nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_recurring OUT, 'data.access_info.permissions.fic_recurring'
DECLARE @Fic_riba nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Fic_riba OUT, 'data.access_info.permissions.fic_riba'
DECLARE @Dic_employees nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Dic_employees OUT, 'data.access_info.permissions.dic_employees'
DECLARE @Dic_settings nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Dic_settings OUT, 'data.access_info.permissions.dic_settings'
DECLARE @Dic_timesheet nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Dic_timesheet OUT, 'data.access_info.permissions.dic_timesheet'
DECLARE @Quotes nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Quotes OUT, 'data.access_info.permissions.fic_issued_documents_detailed.quotes'
DECLARE @Proformas nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Proformas OUT, 'data.access_info.permissions.fic_issued_documents_detailed.proformas'
DECLARE @Invoices nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Invoices OUT, 'data.access_info.permissions.fic_issued_documents_detailed.invoices'
DECLARE @Receipts nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Receipts OUT, 'data.access_info.permissions.fic_issued_documents_detailed.receipts'
DECLARE @Delivery_notes nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_notes OUT, 'data.access_info.permissions.fic_issued_documents_detailed.delivery_notes'
DECLARE @Credit_notes nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Credit_notes OUT, 'data.access_info.permissions.fic_issued_documents_detailed.credit_notes'
DECLARE @Orders nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Orders OUT, 'data.access_info.permissions.fic_issued_documents_detailed.orders'
DECLARE @Work_reports nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Work_reports OUT, 'data.access_info.permissions.fic_issued_documents_detailed.work_reports'
DECLARE @Supplier_orders nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Supplier_orders OUT, 'data.access_info.permissions.fic_issued_documents_detailed.supplier_orders'
DECLARE @Self_invoices nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Self_invoices OUT, 'data.access_info.permissions.fic_issued_documents_detailed.self_invoices'
DECLARE @Through_accountant nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Through_accountant OUT, 'data.access_info.through_accountant'
DECLARE @Clients nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Clients OUT, 'data.plan_info.limits.clients'
DECLARE @Suppliers nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Suppliers OUT, 'data.plan_info.limits.suppliers'
DECLARE @Products nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Products OUT, 'data.plan_info.limits.products'
DECLARE @Documents nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Documents OUT, 'data.plan_info.limits.documents'
DECLARE @Archive nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Archive OUT, 'data.plan_info.functions.archive'
DECLARE @Cerved nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Cerved OUT, 'data.plan_info.functions.cerved'
DECLARE @Document_attachments nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Document_attachments OUT, 'data.plan_info.functions.document_attachments'
DECLARE @E_invoice nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @E_invoice OUT, 'data.plan_info.functions.e_invoice'
DECLARE @Genius nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Genius OUT, 'data.plan_info.functions.genius'
DECLARE @Mail_tracking nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Mail_tracking OUT, 'data.plan_info.functions.mail_tracking'
DECLARE @Payment_notifications nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Payment_notifications OUT, 'data.plan_info.functions.payment_notifications'
DECLARE @Paypal nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Paypal OUT, 'data.plan_info.functions.paypal'
DECLARE @FunctionsReceipts nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @FunctionsReceipts OUT, 'data.plan_info.functions.receipts'
DECLARE @Recurring nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Recurring OUT, 'data.plan_info.functions.recurring'
DECLARE @Smtp nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Smtp OUT, 'data.plan_info.functions.smtp'
DECLARE @Sofort nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Sofort OUT, 'data.plan_info.functions.sofort'
DECLARE @Stock nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Stock OUT, 'data.plan_info.functions.stock'
DECLARE @Subaccounts nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Subaccounts OUT, 'data.plan_info.functions.subaccounts'
DECLARE @Tessera_sanitaria nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Tessera_sanitaria OUT, 'data.plan_info.functions.tessera_sanitaria'
DECLARE @Ts_digital nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Ts_digital OUT, 'data.plan_info.functions.ts_digital'
DECLARE @Ts_invoice_trading nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Ts_invoice_trading OUT, 'data.plan_info.functions.ts_invoice_trading'
DECLARE @Ts_pay nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Ts_pay OUT, 'data.plan_info.functions.ts_pay'
DECLARE @Active nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Active OUT, 'data.plan_info.functions_status.ts_digital.active'
DECLARE @Ts_payActive nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Ts_payActive OUT, 'data.plan_info.functions_status.ts_pay.active'
DECLARE @Accountant_id nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Accountant_id OUT, 'data.accountant_id'
DECLARE @Is_accountant nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Is_accountant OUT, 'data.is_accountant'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
-H "Accept: application/json"
https://api-v2.fattureincloud.it/c/:company_id/company/info
Postman Collection Item JSON
{
"name": "Get Company Info",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "scope",
"value": "entity.clients:r entity.clients:a entity.suppliers:r entity.suppliers:a products:r products:a issued_documents.invoices:r issued_documents.credit_notes:r issued_documents.receipts:r issued_documents.orders:r issued_documents.quotes:r issued_documents.proformas:r issued_documents.delivery_notes:r issued_documents.work_reports:r issued_documents.supplier_orders:r issued_documents.self_invoices:r issued_documents.invoices:a issued_documents.credit_notes:a issued_documents.receipts:a issued_documents.orders:a issued_documents.quotes:a issued_documents.proformas:a issued_documents.delivery_notes:a issued_documents.work_reports:a issued_documents.supplier_orders:a issued_documents.self_invoices:a received_documents:r received_documents:a stock:r stock:a receipts:r receipts:a taxes:r taxes:a archive:r archive:a cashbook:r cashbook:a settings:r settings:a situation:r",
"type": "string"
},
{
"key": "redirect_uri",
"value": "https://api-v2.fattureincloud.it/oauth/token",
"type": "string"
},
{
"key": "accessTokenUrl",
"value": "https://api-v2.fattureincloud.it/oauth/token",
"type": "string"
},
{
"key": "authUrl",
"value": "https://api-v2.fattureincloud.it/oauth/authorize",
"type": "string"
},
{
"key": "grant_type",
"value": "authorization_code",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/c/:company_id/company/info",
"host": [
"{{baseUrl}}"
],
"path": [
"c",
":company_id",
"company",
"info"
],
"variable": [
{
"key": "company_id",
"value": "<integer>"
}
]
},
"description": "Gets the company detailed info."
},
"response": [
{
"name": "Company info.",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/c/:company_id/company/info",
"host": [
"{{baseUrl}}"
],
"path": [
"c",
":company_id",
"company",
"info"
],
"variable": [
{
"key": "company_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"data\": {\n \"id\": \"<integer>\",\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"type\": \"accountant\",\n \"access_info\": {\n \"role\": \"subaccount\",\n \"permissions\": {\n \"fic_situation\": \"read\",\n \"fic_clients\": \"none\",\n \"fic_suppliers\": \"none\",\n \"fic_products\": \"read\",\n \"fic_issued_documents\": \"write\",\n \"fic_received_documents\": \"write\",\n \"fic_receipts\": \"write\",\n \"fic_calendar\": \"detailed\",\n \"fic_archive\": \"detailed\",\n \"fic_taxes\": \"read\",\n \"fic_stock\": \"read\",\n \"fic_cashbook\": \"write\",\n \"fic_settings\": \"read\",\n \"fic_emails\": \"none\",\n \"fic_export\": \"detailed\",\n \"fic_import_bankstatements\": \"none\",\n \"fic_import_clients_suppliers\": \"none\",\n \"fic_import_issued_documents\": \"read\",\n \"fic_import_products\": \"write\",\n \"fic_recurring\": \"none\",\n \"fic_riba\": \"none\",\n \"dic_employees\": \"none\",\n \"dic_settings\": \"read\",\n \"dic_timesheet\": \"read\",\n \"fic_issued_documents_detailed\": {\n \"quotes\": \"none\",\n \"proformas\": \"write\",\n \"invoices\": \"write\",\n \"receipts\": \"write\",\n \"delivery_notes\": \"detailed\",\n \"credit_notes\": \"none\",\n \"orders\": \"write\",\n \"work_reports\": \"none\",\n \"supplier_orders\": \"detailed\",\n \"self_invoices\": \"detailed\"\n }\n },\n \"through_accountant\": \"<boolean>\"\n },\n \"plan_info\": {\n \"limits\": {\n \"clients\": \"<integer>\",\n \"suppliers\": \"<integer>\",\n \"products\": \"<integer>\",\n \"documents\": \"<integer>\"\n },\n \"functions\": {\n \"archive\": \"<boolean>\",\n \"cerved\": \"<boolean>\",\n \"document_attachments\": \"<boolean>\",\n \"e_invoice\": \"<boolean>\",\n \"genius\": \"<boolean>\",\n \"mail_tracking\": \"<boolean>\",\n \"payment_notifications\": \"<boolean>\",\n \"paypal\": \"<boolean>\",\n \"receipts\": \"<boolean>\",\n \"recurring\": \"<boolean>\",\n \"smtp\": \"<boolean>\",\n \"sofort\": \"<boolean>\",\n \"stock\": \"<boolean>\",\n \"subaccounts\": \"<boolean>\",\n \"tessera_sanitaria\": \"<boolean>\",\n \"ts_digital\": \"<boolean>\",\n \"ts_invoice_trading\": \"<boolean>\",\n \"ts_pay\": \"<boolean>\"\n },\n \"functions_status\": {\n \"ts_digital\": {\n \"active\": \"<boolean>\"\n },\n \"ts_pay\": {\n \"active\": \"<boolean>\"\n }\n }\n },\n \"accountant_id\": \"<integer>\",\n \"is_accountant\": \"<boolean>\"\n }\n}"
},
{
"name": "Unauthorized.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/c/:company_id/company/info",
"host": [
"{{baseUrl}}"
],
"path": [
"c",
":company_id",
"company",
"info"
],
"variable": [
{
"key": "company_id"
}
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}