Changes

Jump to: navigation, search

Odata Overview

2,230 bytes added, 8 April
m
How to setup an authenticated user to consume a private OData Service
==SmartSimple Entities Exposed to OData Services==
 
Currently Reports are the only entities exposed through Odata. In the future other entities may be added. Reports were chosen for the following reasons:
==OData Services Endpoints==
Depending on the version SmartSimple OData provides two endpoints: Private and Public Access Endpoints.<br />Endpoints will return a list of the collections (Reports that are OData enabled).Enable [https://wiki.smartsimple.com/wiki/OData_Connector OData required the endpoint will varyConnector] to use these endpoints.
===Private Access Endpoint===A private endpoint will need basic authentication for '''authenticated access''' user to access the collection of entities.<br />Version 4: https: //mysmartsimpleurl/OData/'''V4'''/'''pri'''/424623/Service.svc/<br />Version 3: https: //mysmartsimpleurl/OData/'''V3'''/'''pri'''/424623/Service.svc/<br />Version 2: https: //mysmartsimpleurl/OData/'''V2'''/'''pri'''/424623/Service.svc/
===Public Access Endpoint===If you wish data to be exposed publicly without basic authentication. Note the underlying report must be Internet and OData enabled.<br />Version 4: https: //mysmartsimpleurl/OData/'''V4'''/'''pub'''/424623/Service.svc/<br />Version 3: https: //mysmartsimpleurl/OData/'''V3'''/'''pub'''/424623/Service.svc/<br />Version 2: https: //mysmartsimpleurl/OData/'''V2'''/'''pub'''/424623/Service.svc/
Version 2: https: //mysmartsimpleurl/==How to setup an authenticated user to consume a private OData/Service==For [[JSON API (SmartConnect) Prerequisite|'''V2authenticated access'''/424623/Service]], you will need to create a new user with the API Access attribute.svc/
==Public # Create the new user and set access==to API Access.If you wish the data to be exposed publicly then the different URL is used. Note the underlying report must be Internet and OData enabled# Set a password for this user.
Version 4: https: //mysmartsimpleurl/OData/'''Pub'''/'''V4'''/424623/ServiceFor public access there is no requirement to create a user.svc/
Version 3: https: //mysmartsimpleurl/==Accessing a Report with OData/'''Pub'''/'''V3'''/424623/Service==SmartSimple OData support requests for data via HTTP GET request.Private and Public Endpoints exposes all collections (Reports enabled by OData Connector).svc/
Version 2: https: //mysmartsimpleurl/Syntax below is an example to view OData/records from a report named '''Pub/my_Neo_Report''''''V2'''/424623/Service.svc/ 
==How to setup <pre>http://mysmartsimpleurl/OData from within SmartSimple==/V2/pub/424623/Service.svc/my_Neo_Report_recordsFor '''authenticated access''' you will need to create a new user with the Web http://mysmartsimpleurl/OData/V3/pub/424623/Service.svc/my_Neo_Report_recordshttp://mysmartsimpleurl/OData/V4/pub/424623/Service Client Access attribute.svc/my_Neo_Report_records</pre>
# Create ==OData Primitive Data Types==Primitive type representations in XML request is based on the new user and set access to Web [[Custom Field Type IDs|Data Type]] of the [[Standard Field|Standard Fields]] / [[Custom Fields – General Information|Custom Fields]]<br />Column headers from a report with the following data types will not be successfully transformed in the OData Service Client Access.Report:
# Set a password for this user.* Display Only* Link* Read Only* Store Values
For public access there is no requirement to create a user==Syntax of OData Queries==1. Service Metadata Document - describes the data model exposed as HTTP endpoints by the service.
==Modifying a Report for Use with <pre>http://mysmartsimpleurl/OData==# Edit the Report in Neo Report Builder# Enable the OData checkbox on the Advanced tab# Enable the Internet Enabled checkbox '''if you wish the data to be public'''/V2/pub/424623/Service.svc/$metadata</pre>
2. Search syntax i.e. criteria on report using “???”: the URL below returns OData records with firstname equal ‘steve’ only
<pre>http://mysmartsimpleurl/OData/V4/pub/424623/Service.svc/report_Neo_records?$search=steve</pre>
==Syntax==13. Search syntax i.e. criteria on report using “???”Filter for dynamical search: the URL below returns OData records with firstname equal ‘steve’ only(eq stands for equal in OData protocol)
<pre>http://localhostmysmartsimpleurl/OData/V4/pub/113424623/Service.svc/report_Neo_records?$searchfilter=first_name +eq+steve </pre>
4. Ordering: the URL below orders by first name
2<pre>http://mysmartsimpleurl/OData/V4/pub/424623/Service. Filter for dynamical searchsvc/report_Neo_records?$orderby=first_name+asc or http: the URL below returns //mysmartsimpleurl/OData records with firstname equal ‘steve’ only (eq stands for equal in OData protocol)/V4/pub/424623/Service.svc/report_Neo_records?$orderby=first_name</pre>
<pre>http5. $top and $skip, used mainly for pagination://localhost/OData/V4/pub/113/ServiceThe syntax below skips 3 records and return 2 records only (i.svc/report_Neo_records?$filter=first_name +eq+steve </pre>e. only 4th and 5th will return)
<pre> http://mysmartsimpleurl/OData/V4/pub/424623/Service.svc/report_Neo_records?$top=2&$skip=3. Ordering: the URL below orders by first name</pre>
6. $count, used to determine how many rows in a collection <pre>http://localhostmysmartsimpleurl/OData/V4/pub/113424623/Service.svc/report_Neo_records?$orderby=first_name+asc or http://localhost/OData/V4/pub/113/Service.svc/report_Neo_records?$orderby=first_namecount</pre>
4. $top and $skip, used mainly for pagination: ==Consuming SmartSimple OData Feed==The syntax below skips 3 records and return 2 records only (i.efollowing examples show how to consume OData. only 4th and 5th will return)
<pre> ?$top=2&$skip=3</pre>* [[SmartSimple_OData_Feed_to_Excel|Pulling OData feed to Excel]]* [[SmartSimple_OData_Feed_to_SQL_Server_Database|Import OData feed to SQL Server Database using SQL Server Integration Services]]
==Troubleshooting==
* Report name '''must not''' contain special characters such as question marks, underscore, number sign. Some characters, such as hyphens, are supported.* Column Headings '''must not''' contain special characters such as question marks , number sign or brackets. Some characters, such as hyphens, are supported.* Some applications, such as older versions of MS Excel / .NET , may not support the appropriate level of TLS Encryption (i.e. https) required.
=See Also=
* [[Reports: SmartSimple Reports]]* [[OData Connector]]* [http://www.odata.org More information on OData] [[Category:Integration]][[Category:API]]
Smartstaff
281
edits

Navigation menu