Smart APIs provide two OData actions and corresponding OData functions to manage file(s) retrieval:
-
RetrieveFileUri - call this OData action to initiate file retrieval for a single file.
-
RetrieveFileUris - call this OData action to initiate file retrieval for a collection of files.
-
GetRetrieveFileUriResultAsync - call this OData function to monitor single file retrieval (relevant only if RetrieveFileUriAction is called asynchronously).
-
GetRetrieveFileUrisResultAsync - call this OData function to monitor file retrieval for a collection of files (relevant only if RetrieveFileUrisAction is called asynchronously).
Here are some sample URLs you can use to perform/monitor file(s) retrieval defined for the SampleService:
OData actions are called with HTTP POST.
-
POST https://sam.spclouddave.com/SampleService/Sppid/V2/Pipes('302')/Files('Primary 302')/Com.Ingr.Core.V1.RetrieveFileUri/
-
POST https://sam.spclouddave.com/SampleService/Sppid/V2/Pipes('302')/Files('Primary 302')/Files/Com.Ingr.Core.V1.RetrieveFileUris/
If you examine the metadata document for the SampleService, you will notice the purposes parameter available for the RetrieveFileUris action:
https://sam.spclouddave.com/SampleService/Sppid/V2/$metadata
<Action Name="RetrieveFileUris" IsBound="true">
.
<Parameter Name="purposes" Type="Collection(Com.Ingr.Core.V1.FilePurpose)" Nullable="false"/>
.
</Action>
You can pass the purposes in the body of your request as a JSON array:
{
"purposes": ["Markup", "Rendition"]
}
In this example, the response will return only files having a Markup or Rendition FilePurpose.
The value passed for purposes must be a JSON array of member names from the FilePurpose enumeration, also viewable from the main $metadata document:
<EnumType Name="FilePurpose">
<Member Name="Primary" Value="0"/>
<Member Name="Rendition" Value="1"/>
<Member Name="Markup" Value="2"/>
<Member Name="Reference" Value="3"/>
<Member Name="Other" Value="4"/>
</EnumType>
-
GET https://sam.spclouddave.com/SampleService/Sppid/V2/Pipes('302')/Files('Primary 302')/Com.Ingr.Core.V1.GetRetrieveFileUriResultAsync(resultId='0ffce2fb-9de9-451c-b6eb-0ae9083f1468')/
-
GET https://sam.spclouddave.com/SampleService/Sppid/V2/Pipes('302')/Files('Primary 302')/Files/Com.Ingr.Core.V1.GetRetrieveFileUrisResultAsync(resultId='0ffce2fb-9de9-451c-b6eb-0ae9083f1468')/
The URIs to get the file retrieval results shown are examples. The URI represents a status monitor resource returned as an HTTP Location header in the response, when RetrieveFileUri or RetrieveFileUris is called asynchronously. See Asynchronous support for full details.