Bluemix alchemy api cost - ibm-cloud

I am confused about the cost of the alchemy api. I am trying to figure out the cost of 3000 requests but it looks as if each request costs $0.007 which seems rather expensive. or is it $0.007 per 1000 requests?

You are referring to the standard pay per use plan. Basically the main concept is the API Event, not the request.
As stated in Alchemy API Service terms:
Events are calculated for and included in the information returned by each API call. Calculations vary by the type of service:
Events related to the use of the IBM AlchemyLanguage API will be calculated based on the number of enrichments returned by the API. Many of the API calls require 1 event; some API calls require multiple events.
Events related to the use of the IBM AlchemyVision API will be calculated based on the number of enrichments returned by the API. Many of the API calls require 4 event; some API calls require multiple events.
Events related to the use of the IBM AlchemyData News API will be calculated based on the following facets:
a) the number of enrichments returned by the API; b) the volume of data returned by the API; and c) the length of time, as specified in the API call, used to determine the number of news objects included for analysis.
In the Free plan the customer is entitled to a free allotment of 1.000 API Events per day across all services. In the Standard plan you will be charged per API Event.
The Standard plan is convenient when you need many concurrent calls.
If you are not deploying a large-scale application maybe using some cache services in the right way you can work in the free tier.
Take a look at Pricing for AlchemyAPI Services to read a detailed description of what is a transaction and how AlchemyAPI define those.

Related

WSO2 API manager 4.1 Custom rate limiting - denying requests at definable time intervals

Based on this link, there are four policies for denying requests in the WSO2 API Manager.
Block calls to specific APIs
Block all calls from a given application
Block requests coming from a specific IP address
Block a specific user from accessing APIs
Based on this link, The following keys can be used to create custom rate limiting policies (with Siddhi query language):
resourceKey
userId
apiContext
apiVersion
appTenant
apiTenant
appId
clientIp
I need to deny requests within specific time limits. Maybe particular hours or some specific days. Is there a way to do that?
You can check on Siddhi Query functions to develop your custom Rate Limiting policy in the WSO2 API Manager to perform the limiting within a specified timeframe.
Also, the mentioned requirement can be achieved by developing a Global Synapse Handler and engaging it with the API Manager server. The Synapse Handler implementation is done using Java and will get engaged with each API call invocation.
Siddhi Cron
Synapse Handlers in WSO2 API Manager

Custom GA data costs = Analytics API column missing?

I am trying to use custom cost data (from PLA, price comparison sites), I already upload data on daily basis, it shows up in GA. However, It does not work as expected on API side - as I need to use this cost data for custom reporting, using ga:adCost return cost data only for Google Ads, nothing else. As I have checked, there is no other cost column in dimensions or metrics....
Concrete:
I import cost data using APIs
Success
However, on the API side, when I want to use that data as a source for data export, the only ,,cost,, related colum is adCost - but only Google Ads costs as a traffic source are returned
https://ga-dev-tools.appspot.com/dimensions-metrics-explorer/
I would expect all traffic sources to have ga:adCost (or ga:cost?) in API as well, however, only Google Ads have that. I suppose that ga:ad* is related to GAds connection data only and custom data imported are to passed to Analytics API and/or there is no metric for that data...
Am i doing wrong API calls to get traffic source / medium & cost data, or custom imported data are not able to get back via API?
Is there a solution? Thanks!

How to get sample data from sales force developer account through rest api

I need to get sample data from sales force developer account but i am unable to find any API to get any data from sales force.
Is there any API exposed by sales force to accomplish the task.
Salesforce exposes a large number of thoroughly documented APIs.
Access to record data is most commonly achieved through the standard REST API.
You may be most interested in the endpoints named under Working with Records, which provide access to record data, or Working with Searches and Queries.

Retrieving more than 30 messages using streams/symbols

Background
Given a symbol (i.e. cashtag), I need to retrieve twits from 2015 up to 2019 in order to perform sentiment analysis for a research project.
Problem
The public API is limited to the last 30 messages, as explained in https://api.stocktwits.com/developers/docs/api#streams-symbols-docs.
https://api.stocktwits.com/api/2/streams/symbol/NVDA.json
I tried the same request in an authenticated manner, but I face the same limitation.
https://api.stocktwits.com/api/2/streams/symbol/NVDA.json?access_token=<access_token>
Question
Is there a way to work around the limitation ?
Yes, there is. You should contact their support team, to get Partner level access to download historical data.
"There are some endpoints and data that are not available in the public Stocktwits API, including the full firehose data stream of our content. You may also have an application that requires higher usage limits (rate, message or other limits) than the public API. These additional capabilities are highlighted in the API documentation. If your application requires access to these capabilities, please contact our team to discuss."
https://api.stocktwits.com/developers/contact

Record level access control for REST API GET Collection call

So, I am working on the next project that requires more detailed access control functionality (i.e. Sally can only view products in her department).
I get how either a role based access control model or an attribute access control model can 'wrap' an API call to determine if a given user can perform said action on a given object.
Where I keep getting stuck is when you are dealing with a GET call that returns a collection of records. If I ask the API for a page of 20 records from this endpoint, I can't get 20 records, then run a code based authorization check on those records before returning them as I most likely won't be returning 20 records.
It seems like the authorization check either has to be down in the database and/or happen prior to the database query by adding additional filters to the query call (i.e. also filter where product department = clothing).
Anybody have any more concrete implementation examples or ideas how how this could be implemented in a performant manner?
As David mentioned, XACML can be used at the database level for filtering.
Implementing XACML For The Database
The diagram below is for SQL, but can be used as a general example for any database technology.
Let's see how this works:
SQL statement is intercepted.
A query is sent to the external authorization service that implements XACML
The authorization engine (PDP) evaluates the relevant policies, written in XACML or ALFA (an implementation of XACML).
It may query external attribute sources (PIPs) for more info.
The result: SQL statement is dynamically modified to retrieve only authorized data for the user.
How This Would Be Used In An Application
The implementation of XACML you choose to go with would ideally have an SDK in your language of choice or support the XACML REST profile. Either would work for integration into your application.
Given that you are using REST calls, I don't think you would have to add much code to integrate your application with an implementation of XACML.
Implementing XACML for an API Gateway
The principle used in this integration is the ability of an API gateway to make a callout to a third party service.
In this case the third party service is your XACML implementation's Policy Decision Point (PDP). The implementation must support REST/JSON.
The API Gateway is configured to send fine-grained authorization requests to the PDP.
Requests are made using the REST/JSON interface exposed by the PDP. The PDP then returns a response.
The JSON profile of XACML extends the Request/Response schema allowing both the Request and the Response to be encoded in JSON instead of the traditional XML encoding. This makes the Request and the Response much easier to read and also much smaller in size thus transferring less data.
Implementations of XACML
For an entire list of XACML implementations, you can check this list on Wikipedia.
Full disclosure - I work for Axiomatics with David Brossard, who designed the JSON profile for XACML to be used in conjunction with the REST profile.
Axiomatics provides Axiomatics Data Access Filter for relational databases and SmartGuard for HADOOP. Axiomatics Policy Server natively supports both JSON and REST profiles.