API : Utilisation du nouveau paramètre de requête API "fields", Alternative à "return object"
Introduction
Pour de meilleures performances lors de l'utilisation des API, nous recommandons aux clients d'utiliser des filtres API ou return_object dans les requêtes, mais les filtres API ne sont disponibles que pour des types d'objets spécifiques, et dans les versions futures, nous déprécierons le return_object. Dans ce cadre, la manière alternative de créer des filtres API dynamiques au besoin peut être spécifiée en tant que paramètre de requête API avec les champs dont nous avons besoin.
Les champs nouvellement ajoutés dans les API n'apparaîtront dans les réponses de l'API que lorsqu'ils sont accompagnés d'un champ spécifique mentionné dans le filtre de réponse de l'API ou le paramètre de requête « champs ».
Objets d'intégration
Ces objets fonctionnent avec le paramètre de requête : fields
API d'approbations
https ://<customer>.coupahost.com/api/approvals?fields=["id","created-at"]&limit=1
https ://<customer>.coupahost.com/api/approvals?approvable-type=EasyFormResponse&status[in]=pending_approval,approved&updated-at[gt_or_eq]=2021-11-01T00:00:00&fields=["id","approvable-type","approvable-id"]
API des frais
https ://<customer>.coupahost.com/api/charges?fields=["id","external-ref-id"]&limit=1
Exemple de champs imbriqués :
https ://<customer>.coupahost.com/api/charges?fields=["id","external-ref-id",{"currency" :["code"]}]&limit=1
Contrats API :
Exemple : https ://<customer>.coupahost.com/api/contracts?status=published&fields=["id","status"]&limit=1
Exemple de champs imbriqués :
https ://<customer>.coupahost.com/api/charges? ?limit=1&fields=["id","external-ref-id",{"supplier" :["id","name"]}]
API de paiements CoupaPay
https ://<customer>.coupahost.com/api/coupa_pay/payments?status=published&fields=["id","status"]&limit=1
Exemple de champs imbriqués :
fields=["id","payment-batch-id","status","exchange_rate","updated_at",{"pay_from_account" :["id",{"currency" :["code"]}]},{"pay_to_currency" :["code"]},{"payee" :["number"]},{"digital_check" :["check_number"]},{"payment_details" :["id","updated_at","source_transaction_id","source_transaction_reference","discount_total","payment_total",{"payable_allocations" :["id","updated_at","payable_to_amount","source_transaction_to_reference","source_transaction_to_id"]},{"currency" :["code"]}]}]
API des objets personnalisés
https ://.coupahost.com/api/custom_objects/<customer><ID>/object_instances ?updated_at[gt_or_eq]=2021-11-10&fields=["id","created_at","updated_at","custom_object_name","custom_object_code","form_response_id","owner_id","due_date","start_date","duration","percentage","linkable_type","linkable_id",{"created_by" : ["id"]},{"updated_by" : ["id"]},{"custom_fields" : {}}]
API de réponses au formulaire simplifié
https ://.coupahost.com/api/easy_form_responses/<customer><ID> ?fields=["id","created_at","updated_at","easy_form_id","name","status","submitted_at",{"subject" : ["id","supplier_id","custom_object_name","custom_object_code"]},{"easy_form_widget_responses" : ["id","easy_form_id","easy_form_widget_id","easy_form_response_id","answer","type","field_name","widget_label"]},{"requested_by" : ["id"]},{"created_by" : ["id"]},{"updated_by" : ["id"]}]
API Notes de frais
https ://<customer>.coupahost.com/api/expense_reports?status=approved_for_payment&fields=["id","title"]&limit=1
Exemple de champs imbriqués :
https ://<customer>.coupahost.com/api/users?status=active&fields=["id",{"expense_lines" :["id","amount"]}]&limit=1
API Factures
https ://<customer>.coupahost.com/api/invoices?status=approved&fields=["id","status"]&limit=1
Exemple pour les champs imbriqués :
/INVOICES/:id ?fields=["id", "invoice-number", { "currency" : [ "code" ] },{"account_type" :["id", "name"]}]
API d'articles
https ://<customer>.coupahost.com/api/items?fields=["id","created-at"]&limit=1
API pour les bons de commande
https ://<customer>.coupahost.com/api/purchase_orders?status=issued&fields=["id","status"]&limit=1
Exemple pour les champs imbriqués :
https ://.coupahost.com/api/purchase_orders?limit=1&fields<customer> =[ "id", "created_at", "updated_at", "order_header_id", "po_number", "status", "version", {"custom_fields" : {} }, { "ship_to_address" : ["id", "created_at", "updated_at", "name", "location_code", "street1", "street2", "city", "state", "postal_code", "attention", "active", {"country" : ["code"] }, {"custom_fields" : {}}] }, {"ship_to_user" : ["id", "login"] }, {"supplier" : ["id", "name", "display_name", "number", {"primary_address" : ["id", "name", "location_code", "street1", "street2", "city", "state", "postal_code", "attention" active ", {" country ": ["]] }}, {"payment_code" : [id "," id "], {" currency ": { " code "shipping_shipping"] }, {"term_code" : { "id", "order_code"]}, {"order_code", "updated_at", "line_num", "description", "order_header_change_id", "order_line_id", "price", "quantity", "total", { "account" : [ "id", "name", "code", "segment_1", "segment_2", "segment_3", "segment_4" ] }, { "custom_fields" : {} }, { "currency" : [ "code" ] }, { "commodity" : [ "name", { "custom_fields" : {} } ] }, { "uom" : [ "code" ] } ] }, { "current_approval" : [ "id", "created_at", "updated_at", "position", "approval_chain_id", "status", "approval_date", "note", "type", "approvable_type", "approvable_id", "delegate_id", { "approver" : [ "id" ] }, { "approved_by", "login", "employee_number"] }}, {"approvals" : [id "," id "," created "," at "updated_position", "at", "date_approbation_id", "status", "approval_id", "type", "approvable_type", "approgate_id", "," idgate_type "," ", { " approved_by ": [ " id "," login "," employee_number " ] } ] }]
API de modifications des bons de commande
https ://<customer>.coupahost.com/api/purchase_order_changes?fields=["id","created-at"]&limit=1
Exemple pour les champs imbriqués :
https ://.coupahost.com/api/purchase_orders?limit=1&fields<customer> =[ "id", "created_at", "updated_at", "order_header_id", "po_number", "status", "version", {"custom_fields" : {} }, { "ship_to_address" : ["id", "created_at", "updated_at", "name", "location_code", "street1", "street2", "city", "state", "postal_code", "attention", "active", {"country" : ["code"] }, {"custom_fields" : {}}] }, {"ship_to_user" : ["id", "login"] }, {"supplier" : ["id", "name", "display_name", "number", {"primary_address" : ["id", "name", "location_code", "street1", "street2", "city", "state", "postal_code", "attention" active ", {" country ": ["]] }}, {"payment_code" : [id "," id "], {" currency ": { " code "shipping_shipping"] }, {"term_code" : { "id", "order_code"]}, {"order_code", "updated_at", "line_num", "description", "order_header_change_id", "order_line_id", "price", "quantity", "total", { "account" : [ "id", "name", "code", "segment_1", "segment_2", "segment_3", "segment_4" ] }, { "custom_fields" : {} }, { "currency" : [ "code" ] }, { "commodity" : [ "name", { "custom_fields" : {} } ] }, { "uom" : [ "code" ] } ] }, { "current_approval" : [ "id", "created_at", "updated_at", "position", "approval_chain_id", "status", "approval_date", "note", "type", "approvable_type", "approvable_id", "delegate_id", { "approver" : [ "id" ] }, { "approved_by", "login", "employee_number"] }}, {"approvals" : [id "," id "," created "," at "updated_position", "at", "date_approbation_id", "status", "approval_id", "type", "approvable_type", "approgate_id", "," idgate_type "," ", { " approved_by ": [ " id "," login "," employee_number " ] } ] }]
API de demandes
https ://<customer>.coupahost.com/api/requisitions?status=ordered&fields=["id","status"]&limit=1
Exemple pour les champs imbriqués :
https ://.coupahost.com/api/requisitions?limit=1&fields<customer> =[ "id", "submitted_at", "us_estimated_tax", {"currency" : ["code"] }, {"ship_to_address" : ["id", "name", "location_code", "street1", "street2", "city", "state", "postal_code", "attention", "active", "vat_number", {"country" : ["code"]}, {"custom_fields" : {}}] }, {"réquisition_lines" : ["id", "description", "line_num", "need_by_date", "order_line_id", "quantity", "source_part_num", "unspsc_code", "status", "supp_aux_part_num", "total", "line_type", "supplier_site_id", "unit_price", { "account" : [name "," code "," segment_1 "," segment_2 "," segment_3 "," segment_4 "," segment_date "{" type_account ":"] }, "uom", "shipping_code", {"term"], {"display_name", "], {" primary_name "," nom "," nom de la rue "," nom de la ville "," id "," nom de la ville "," id "id", "nom de la chaîne", "," id "id", "id" id ",", "id", "nom de la station", "id" id "," id "," id "id" id ",", "id", "id" id "id", "id" id ",", "id", "," id "," nom de la position ",", "," id "id" id "," id "id", "id" id "," id "id", "," id "id", "," id "," id "id", "id", ",", "," id "id" id "," id "id", "," id "id", "," id "id", ",", ",", ",", ",", ",", "," id ",", ",", "id", "id" id "id" id "," id ",", "id" id "id" id "id", "," id "," ",", "id", ",", "," id ",", "," id "id", ",", "id" id ",", "id" id ",", ",", ",", "", ",", "" id "id" id "id", ",", "id", "," id ",", "id" ",", ",", "," id "," id "id" id ",", "," id "," id "," ",", "id", "id", "," id "id" "," id ",", ",", "", ",", "", ",", ",", "", ",", "", ",", "id" ",", "id", ",", ",", "", ",", "", ",", ",", "," "", "", ",", ",", "", "" "" ",", "," "" "" "" ",", "," "" "" "" "", "," "", ","
API Fournisseurs
Exemple : https ://<customer>.coupahost.com/api/suppliers?status=active&fields=["id","name"]&limit=1
Exemple de champs imbriqués :
https ://<customer>.coupahost.com/api/users?status=active&fields=["id",{"primary_contact" :["name-given"]}]&limit=1
API des articles du fournisseur
https ://<customer>.coupahost.com/api/supplier_items?fields=["id","created-at"]&limit=1
API de flux de sensibilisation aux risques fournisseurs
https ://<customer>.coupahost.com/api/supplier_risk_aware_feed?fields=["id","number-field-01"]&limit=1
Exemple de champs imbriqués :
https ://<customer>.coupahost.com/api/users?status=active&fields=["id",{"supplier" :["id","name"]}]&limit=1
API des tâches
https ://.coupahost.com/api/tasks?<customer> &updated_at[gt_or_eq]=2021-07-01& linkable-type = Project&owner-id [blank]= false&linkable [status] [not_eq] = draft&fields =["id", "created_at","updated_at", "title", "description","status","owner_id","due_date","start_date","duration", "percentage", "linkable_type", "linkable_id",{"owner" : ["id"]}, {"resolved_by" : ["id"]}, {"linkable" : ["id","created_at","updated_at","name", "active", "open","description","mention_name", "start_date","external_reference_number", "end_date", "commodity_id", "status",{"template_group" : ["id", name ",{" custom_fields ": {}}},{" category ":" id "," name ",", "custom_fields" : {}}, {"département", "id", "}, {" custom_name ": {" users "}, {" id "},{"], {"email_fields" : {}},{"custom_id"}},{ "custom_fields" : {}}}
API Utilisateurs
Exemple : https ://<customer>.coupahost.com/api/users?status=active&fields=["id","email"]&limit=1
Exemple de champs imbriqués :
https ://<customer>.coupahost.com/api/users?status=active&fields=["id","external-ref-id",{"roles" :["name"]}]&limit=1
Doc Référence Filtre API
Article du portail Succès : https://success.coupa.com/Integrate/Integration_Knowledge_Articles/API_Response_Filters#As_an_operator
Une partie ou la totalité de cette page peut avoir été traduite par machine. Toutes nos excuses pour les inexactitudes.