Documentation for document_types
index
Overview
Allows to retrieve the list of the document types of an entity.
As all others, this method requires authentication. To understand how to retrieve the authentication token, refer to the Login documentation page.
Request
- endpoint
- /api/v1/document_types.[format]
- http method
- GET
format must be either json or xml
Required Parameters
- entity_id
- ID of the entity whom document types you want to show, as obtained by the entities/index api call.
Optional Parameters
None
Response
Response is a list of all the document types owned by the entity. Each entry has the following attributes:
- dc_identifier
- unique identifier of this entity
- name
- name of the document_type
This is a sample response in JSON format:
{"document_types": [ {"dc_identifier":"DT:00001","name":"Invoice"}, {"dc_identifier":"DT:00002","name":"Report"}, {"dc_identifier":"DT:00003","name":"Weekly Expenses Report"} ] }
This is a sample response in XML format:
<?xml version="1.0" encoding="UTF-8"?> <document-types type="array"> <document-type> <dc-identifier>DT:00001</dc-identifier> <name>Invoice</name> </document-type> <document-type> <dc-identifier>DT:00002</dc-identifier> <name>Report</name> </document-type> <document-type> <dc-identifier>DT:00003</dc-identifier> <name>Weekly Expenses Report</name> </document-type> </document-types>
Examples
In each sample below, you have to substitute values between angular brackets (< and >) with the correct input data.
cUrl
curl -H "Authorization: Token token=<auth_token>" https://www.myo.io/api/v1/document_types.json -G -d 'entity_id=<entity_id>'
Ruby (with rest_client)
require 'rest_client' RestClient::Request.new(:method => "get", :url => 'https://www.myo.io/api/v1/document_types.json', :headers => { :accept => :json, :content_type => :json, :'Authorization' => "Token token=<auth_token>"}, :payload => {:entity_id => <entity_id>}).execute