Интерфейс OData
OData это стандарт, который определяет лучшие практики для создания и использования API данных. Он построен на основных протоколах, таких как HTTP, и общепринятых методиках, таких как REST. Результатом является унифицированный способ реализации полнофункциональных API данных.
AutoCAD I/O API использует OData V4.0.
Чтобы получить метаданные OData, используйте следующий запрос:
GET autocad.io/us-east/v2/$metadata
Пример ответа:
- HTTP/1.1 200 OK
- Cache-Control: no-cache
- Content-Type: application/xml
- Date: Tue, 19 May 2015 18:28:32 GMT
- Expires: -1
- Pragma: no-cache
- Server: Microsoft-IIS/8.5
- X-AspNet-Version: 4.0.30319
- X-Powered-By: ASP.NET
- Content-Length: 10768
- Connection: keep-alive
- <?xml version="1.0" encoding="utf-8"?>
- <edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
- <edmx:DataServices>
- <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="ACES.Models">
- <EntityType Name="Activity">
- <Key>
- <PropertyRef Name="Id"/>
- </Key>
- <Property Name="AppPackages" Type="Collection(Edm.String)"/>
- <Property Name="HostApplication" Type="Edm.String"/>
- <Property Name="RequiredEngineVersion" Type="Edm.String" Nullable="false"/>
- <Property Name="Parameters" Type="ACES.Models.Parameters" Nullable="false"/>
- <Property Name="Instruction" Type="ACES.Models.Instruction" Nullable="false"/>
- <Property Name="AllowedChildProcesses" Type="Collection(ACES.Models.AllowedChildProcess)"/>
- <Property Name="IsPublic" Type="Edm.Boolean" Nullable="false"/>
- <Property Name="Version" Type="Edm.Int32" Nullable="false"/>
- <Property Name="Timestamp" Type="Edm.DateTimeOffset" Nullable="false"/>
- <Property Name="Description" Type="Edm.String"/>
- <Property Name="Id" Type="Edm.String" Nullable="false"/>
- </EntityType>
- <EntityType Name="AppPackage">
- <Key>
- <PropertyRef Name="Id"/>
- </Key>
- <Property Name="References" Type="Collection(Edm.String)"/>
- <Property Name="Resource" Type="Edm.String"/>
- <Property Name="RequiredEngineVersion" Type="Edm.String"/>
- <Property Name="IsPublic" Type="Edm.Boolean" Nullable="false"/>
- <Property Name="IsObjectEnabler" Type="Edm.Boolean" Nullable="false"/>
- <Property Name="Version" Type="Edm.Int32" Nullable="false"/>
- <Property Name="Timestamp" Type="Edm.DateTimeOffset" Nullable="false"/>
- <Property Name="Description" Type="Edm.String"/>
- <Property Name="Id" Type="Edm.String" Nullable="false"/>
- </EntityType>
- <EntityType Name="WorkItem">
- <Key>
- <PropertyRef Name="Id"/>
- </Key>
- <Property Name="ActivityId" Type="Edm.String"/>
- <Property Name="Arguments" Type="ACES.Models.Arguments" Nullable="false"/>
- <Property Name="Status" Type="ACES.Models.ExecutionStatus"/>
- <Property Name="StatusDetails" Type="ACES.Models.StatusDetails"/>
- <Property Name="AvailabilityZone" Type="ACES.Models.DataAffinity"/>
- <Property Name="TimeQueued" Type="Edm.DateTimeOffset"/>
- <Property Name="TimeInputTransferStarted" Type="Edm.DateTimeOffset"/>
- <Property Name="TimeScriptStarted" Type="Edm.DateTimeOffset"/>
- <Property Name="TimeScriptEnded" Type="Edm.DateTimeOffset"/>
- <Property Name="TimeOutputTransferEnded" Type="Edm.DateTimeOffset"/>
- <Property Name="BytesTranferredIn" Type="Edm.Int64"/>
- <Property Name="BytesTranferredOut" Type="Edm.Int64"/>
- <Property Name="Timestamp" Type="Edm.DateTimeOffset" Nullable="false"/>
- <Property Name="Id" Type="Edm.String" Nullable="false"/>
- </EntityType>
- <EntityType Name="Engine">
- <Key>
- <PropertyRef Name="Id"/>
- </Key>
- <Property Name="Resource" Type="Edm.String"/>
- <Property Name="IsPublic" Type="Edm.Boolean" Nullable="false"/>
- <Property Name="Version" Type="Edm.Int32" Nullable="false"/>
- <Property Name="Timestamp" Type="Edm.DateTimeOffset" Nullable="false"/>
- <Property Name="Description" Type="Edm.String"/>
- <Property Name="Id" Type="Edm.String" Nullable="false"/>
- </EntityType>
- <EntityType Name="RemoteFile">
- <Key>
- <PropertyRef Name="Resource"/>
- </Key>
- <Property Name="UserId" Type="Edm.String"/>
- <Property Name="Version" Type="Edm.Int32" Nullable="false"/>
- <Property Name="Resource" Type="Edm.String" Nullable="false"/>
- <Property Name="LocalFileName" Type="Edm.String" Nullable="false"/>
- <NavigationProperty Name="RelatedFiles" Type="Collection(ACES.Models.RemoteFile)"/>
- </EntityType>
- <ComplexType Name="Parameters">
- <Property Name="InputParameters" Type="Collection(ACES.Models.Parameter)"/>
- <Property Name="OutputParameters" Type="Collection(ACES.Models.Parameter)"/>
- </ComplexType>
- <ComplexType Name="Arguments">
- <Property Name="InputArguments" Type="Collection(ACES.Models.Argument)"/>
- <Property Name="OutputArguments" Type="Collection(ACES.Models.Argument)"/>
- </ComplexType>
- <ComplexType Name="Parameter">
- <Property Name="Name" Type="Edm.String" Nullable="false"/>
- <Property Name="LocalFileName" Type="Edm.String" Nullable="false"/>
- <Property Name="Optional" Type="Edm.Boolean"/>
- </ComplexType>
- <ComplexType Name="Argument">
- <Property Name="Resource" Type="Edm.String"/>
- <Property Name="Name" Type="Edm.String" Nullable="false"/>
- <Property Name="Headers" Type="Collection(ACES.Models.Header)"/>
- <Property Name="ResourceKind" Type="ACES.Models.ResourceKind"/>
- <Property Name="StorageProvider" Type="ACES.Models.StorageProvider"/>
- <Property Name="HttpVerb" Type="ACES.Models.HttpVerbType"/>
- </ComplexType>
- <ComplexType Name="Instruction">
- <Property Name="CommandLineParameters" Type="Edm.String"/>
- <Property Name="Script" Type="Edm.String"/>
- </ComplexType>
- <ComplexType Name="AllowedChildProcess">
- <Property Name="Name" Type="Edm.String"/>
- <Property Name="RelativePath" Type="Edm.String"/>
- </ComplexType>
- <ComplexType Name="Header">
- <Property Name="Name" Type="Edm.String"/>
- <Property Name="Value" Type="Edm.String"/>
- </ComplexType>
- <ComplexType Name="BoundArgument" BaseType="ACES.Models.Argument">
- <Property Name="LocalFileName" Type="Edm.String"/>
- <Property Name="Optional" Type="Edm.Boolean"/>
- </ComplexType>
- <ComplexType Name="StatusDetails">
- <Property Name="Report" Type="Edm.String"/>
- </ComplexType>
- <EnumType Name="ResourceKind">
- <Member Name="Simple" Value="0"/>
- <Member Name="EtransmitPackage" Value="1"/>
- <Member Name="RemoteFileResource" Value="2"/>
- <Member Name="ZipPackage" Value="3"/>
- <Member Name="Embedded" Value="4"/>
- <Member Name="Variadic" Value="5"/>
- </EnumType>
- <EnumType Name="StorageProvider">
- <Member Name="A360" Value="0"/>
- <Member Name="Generic" Value="1"/>
- </EnumType>
- <EnumType Name="HttpVerbType">
- <Member Name="GET" Value="0"/>
- <Member Name="PUT" Value="1"/>
- <Member Name="POST" Value="2"/>
- <Member Name="HEAD" Value="3"/>
- </EnumType>
- <EnumType Name="ExecutionStatus">
- <Member Name="Pending" Value="0"/>
- <Member Name="InProgress" Value="1"/>
- <Member Name="Succeeded" Value="256"/>
- <Member Name="FailedEnvironmentSetup" Value="-5"/>
- <Member Name="FailedUpload" Value="-4"/>
- <Member Name="FailedMissingOutput" Value="-3"/>
- <Member Name="FailedExecution" Value="-2"/>
- <Member Name="FailedDownload" Value="-1"/>
- </EnumType>
- <EnumType Name="DataAffinity">
- <Member Name="AmazonNorthernVirginia" Value="0"/>
- <Member Name="AzureWestUS" Value="1"/>
- </EnumType>
- </Schema>
- <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Operations">
- <Function Name="GetPublisher" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.AppPackage"/>
- <ReturnType Type="Edm.String" Unicode="false"/>
- </Function>
- <Function Name="GetUploadUrl" IsBound="true">
- <Parameter Name="bindingParameter" Type="Collection(ACES.Models.AppPackage)"/>
- <ReturnType Type="Edm.String" Unicode="false"/>
- </Function>
- <Function Name="GetVersions" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.AppPackage"/>
- <ReturnType Type="Collection(ACES.Models.AppPackage)"/>
- </Function>
- <Action Name="SetVersion" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.AppPackage"/>
- <Parameter Name="Version" Type="Edm.Int32" Nullable="false"/>
- </Action>
- <Action Name="DeleteHistory" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.AppPackage"/>
- </Action>
- <Function Name="GetPublisher" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.Activity"/>
- <ReturnType Type="Edm.String" Unicode="false"/>
- </Function>
- <Function Name="GetVersions" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.Activity"/>
- <ReturnType Type="Collection(ACES.Models.Activity)"/>
- </Function>
- <Action Name="SetVersion" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.Activity"/>
- <Parameter Name="Version" Type="Edm.Int32" Nullable="false"/>
- </Action>
- <Action Name="DeleteHistory" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.Activity"/>
- </Action>
- <Function Name="GetPublisher" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.Engine"/>
- <ReturnType Type="Edm.String" Unicode="false"/>
- </Function>
- <Function Name="GetUploadUrl" IsBound="true">
- <Parameter Name="bindingParameter" Type="Collection(ACES.Models.Engine)"/>
- <ReturnType Type="Edm.String" Unicode="false"/>
- </Function>
- <Function Name="GetVersions" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.Engine"/>
- <ReturnType Type="Collection(ACES.Models.Engine)"/>
- </Function>
- <Action Name="SetVersion" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.Engine"/>
- <Parameter Name="Version" Type="Edm.Int32" Nullable="false"/>
- </Action>
- <Action Name="DeleteHistory" IsBound="true">
- <Parameter Name="bindingParameter" Type="ACES.Models.Engine"/>
- </Action>
- <EntityContainer Name="Container">
- <EntitySet Name="Activities" EntityType="ACES.Models.Activity"/>
- <EntitySet Name="AppPackages" EntityType="ACES.Models.AppPackage"/>
- <EntitySet Name="WorkItems" EntityType="ACES.Models.WorkItem"/>
- <EntitySet Name="Engines" EntityType="ACES.Models.Engine"/>
- </EntityContainer>
- </Schema>
- </edmx:DataServices>
- </edmx:Edmx>
Детали этих метаданных - это всё классы и функции AutoCAD V2 API. И они могут быть использованы только клиентами OData 4.0. Пожалуйста, проверьте наши примеры на C# и Java на предмет новых способов доступа к V2 API.
Источник: https://developer.autodesk.com/api/autocadio/#odata-interface
Обсуждение: http://adn-cis.org/forum/index.php?topic=4293
Опубликовано 11.02.2016