"No access to API product" error when trying to reach Data Connector API - autodesk-forge

I'm experiencing issues when trying to call the Data Connector API via Postman.
When executing the POST request to submit a data request, Postman returns the following error:
"developerMessage": "The client_id specified does not have access to the api product",
"moreInfo": "https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/",
"errorCode": "AUTH-001"
Here is what I've tried:
I have created a Forge app which has access to all APIs.
The user has Executive Overview permissions within the account (which has many projects).
I call the API using a 3-legged auth token with data:read, data:write and data:create scopes.
This is the code I'm using (exported from Postman):
curl --location --request POST 'https://developer.api.autodesk.com/data-connector/v1/accounts/<ACCOUNT_ID>/requests' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <BEARER_TOKEN>' \
--data-raw '
{
"description": "Test Extract",
"scheduleInterval": "ONE_TIME",
"effectiveFrom": "2021-01-30T12:00:00Z",
"serviceGroups": ["admin", "checklists", "dailylogs", "issues", "locations", "submittals", "cost", "rfis"]
}'
Your help would be highly appreciated. Thanks!

Jro, Simon, Data Connector API is now accessible. Could you give it a try if it can work at your side? Thank you for your patience and any feedback!

I have the exact same issue as yours, I don't know if the API is really public or not.
Hope that someone from Adesk forge team could answer us.

yes, this API is public beta now. We are working with engineer team and will get back to you soon. Our apology for the issue!

Related

Working curl command to send SMS via Twilio API but need in JSON format

I am not a coder, but did stay at a Holiday Inn Express once. Working on a solution to automatically send SMS messages to customers giving them updates.
I have a working Curl command, but the system that will trigger the webhook must be setup as follows (The tool is Freshdesk) :
Image of Input for API trigger (Freshdesk)
This is the curl command that I have made work with no problems:
`curl 'https://api.twilio.com/2010-04- 01/Accounts/AccountSID/Messages.json' -X POST \
--data-urlencode 'To=+19155402805' \
--data-urlencode 'From=+15104055319' \
--data-urlencode 'Body=This is the update you were asking for' \
-u Account_SID:[AuthToken]`
I was able to import this into Postman and again it works great. When I try to use the format provided it gives me the Response Text = {"code": 21604, "message": "A 'To' phone number is required.", "more_info": "https://www.twilio.com/docs/errors/21604", "status": 400} error.
This is what I have tried so far and it is not working:
`{
"To": "+19155409999",
"From": "+15109999999",
"Body": "Its Me, Its Me"
}`
I know this is something easy and stupid, but haven't been able to solve it yet. Any help would be appreciated.
Thank you for the time.

Unable to exchange `code` for Salesforce Marketing Cloud token

I am trying to exchange a Salesforce Marketing Cloud (SFMC) authorization_code for an access_token per the docs here: https://developer.salesforce.com/docs/atlas.en-us.mc-app-development.meta/mc-app-development/access-token-app.htm
curl https://{my_subdomain}.auth.marketingcloudapis.com/v2/token \
--request POST \
--header "Content-Type: application/json" \
--data '{"grant_type": "authorization_code", "code": "{{my_code}}", "client_id": "{{my_client_id}}", "redirect_uri": "https://127.0.0.1:80/", “client_secret: “{{my_client_secret}}”, "scope": "audiences_read list_and_subscribers_write offline"}'
Yet it continually gives me the following error:
{"documentation":"https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm","errorcode":0,"message":"Bad Request"}%
I have no idea where I am going wrong, any help is appreciated.
I was seeing "correct" errors when I was using an expired code and when my client_id and/or client_secret were wrong, but nothing after I pasted in the correct values. Perhaps it is my scopes?
According to the docs linked in the error code, The token was not found in the request, or it is invalid or expired.. This is the only error code that has customcode == 0. It is strange since I am trying to get a token, not pass one in, and that error code is associated with a 401, which may or may not be what I am receiving back.
It turns out my client_secret in my data was using the incorrect double quote. It was a slanted double-quote. I discovered this when I tried using Python3 instead of cURL and was converting my JSON above into JSON to pass to the requests library. I was able to successfully get a token.
So the answer is, the above is correct, just watch your encodings!

SVF POST job file conversion failure

A friend and I are following the Autodesk Viewer tutorial here:
https://developer.autodesk.com/en/docs/viewer/v2/tutorials/basic-viewer/
We've both completed all the previous steps except for the very last of using the APIs POST job endpoint to send a base64 encoded urn off to the Model Derivative API for conversion to a SVF file so that Autodesk's Viewer may use it.
This is what I'm using to send the POST job request:
curl -X 'POST' -H 'Authorization: Bearer cywr9WWu8kml3rQIVnPDohFDsoRl' -H
'Content-Type: application/json' -v 'https://developer.api.autodesk.com/modelderivative/v2/designdata/job'
-d '{"input": {"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXl0ZXN0YnVja2V0dGVzdDIvZ2lyaV9zaXJfY29weTEucnZ0"},
"output": {"formats": [{"type": "svf","views": ["2d","3d"]}]}}'
and this is the APIs response:
{"type":"manifest","hasThumbnail":"false","status":"failed","progress":"complete",
"region":"US","urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXl0ZXN0YnVja2V0dGVzdDIvZ2lyaV9zaXJfY29weTEucnZ0",
"derivatives":[{"name":"giri_sir_copy1.rvt","hasThumbnail":"false","status":"failed",
"progress":"complete","messages":[{"type":"error","code":"Revit-InternalError",
"message":"<message>We have encountered some issues while preparing the file for viewing.
Please contact support for assistance.</message>"},{"type":"error",
"message":"Unrecoverable exit code from extractor: -1073741831",
"code":"TranslationWorker-InternalFailure"}],"outputType":"svf"}]}
Any insights is greatly appreciated.
Summarizing the comments on the question: here is the link to the sample running and source code (postJob function).
Please note this sample is storing the file directly under the developer account (OSS), not under the user account (Data Management), it's an important difference! The first uses 2-legged token, the second uses 3-legged token. Data Management contains some abstractions/metadata to organize the files, like hubs, projects and folders, but ultimately stores on OSS. Depending on the way it was stored, you need different tokens/permissions to read/write it.

Miniflux API URL endpoint

I have Miniflux running on an Amazon EC2 instance which I intend to use for my Android application. According to the Miniflux documentation here I should be able to get a JSON response with this URL endpoint:
www.mydomain/miniflux/jsonrpc.php
which in my case is:
{
"jsonrpc":"2.0",
"id":null,
"error":{
"code":-32700,
"message":"Parse error"
}
}
To get more information in JSON format I need to pass in more arguments but the Miniflux documentation does not explain how. The OpenWeatherMap API on the other hand, has a guide on how the URL endpoint may be used with the API key. Any advice on this matter will be greatly appreciated.
first go to miniflix preferences and pick your JSON-RPC URL. it must be something like: API endpoint: https://username.miniflux.net/jsonrpc.php.
there also you will get:
API username: username
API token: swB3/nSo1CB1X2F (example)
type the end point url into your rest client application or chrome extension like postman.
on postman use HTTP Basic Authentication. means put the your login user name in the usename field, api token in the poassword filed then click on Refresh headers button.
chose post method (as all miniflux jsonrpc calls are post) then navigate to "row" tab and write your query like:
{"url": "http://images.apple.com/main/rss/hotnews/hotnews.rss"}, "id": 1}
then you will see the json response.
if you want to use curl it is simple also.
curl \
-u "demo:swB3/nSo1CB1X2F" \
-d '{"jsonrpc": "2.0", "method": "feed.create", "params": {"url": "http://images.apple.com/main/rss/hotnews/hotnews.rss"}, "id": 1}' \
https://demo.miniflux.net/jsonrpc.php
I suggest you to spend sometime reading their JsonRPC code then you will come to understand all the miniflux api calls, response and how it works.
Assuming, for example, your miniflux API reports the following parameters:
API username: username
API endpoint: https://username.miniflux.net/jsonrpc.php
API token: swB3/nSo1CB1X2F
Lift the API method you want from direct the curl -d statements in the miniflux documentation. E.g., for the method to list all feeds (for the sake of convenience, calling it 'payload'):
payload = {"jsonrpc": "2.0", "method": "feed.list", "id": 1}
Assemble a python equivalent of curl's -u command from the username and token API parameters:
auth=('username', 'swB3/nSo1CB1X2F')
Import python's request and json modules and use them to query the miniflux API. The assembled request statement is equivalent to the curl command given in the miniflux documentation:
response = requests.post('https://username.miniflux.net/jsonrpc.php', auth=auth, data=json.dumps(payload), headers=headers).json()
using python3

Need a little help integrating JAXRSClientFactory with OpenAM RESTful service

I admit I'm a greenhorn with web services.
I am attempting to call an OpenAM restful web service from a legacy unprotected tomEE+ servlet. My problem is that I don't understand what I should be creating for the second argument of:
JAXRSClientFactory.create("http://openam.mylocalAMserver.lan:8080/openam/json/authenticate", WhatClassGoesHere.class);
The OpenAM documentation provides this:
3.3.1. Authentication & Logout
$ curl --request POST --header "X-OpenAM-Username: demo" --header
"X-OpenAM-Password: changeit" --header "Content-Type:
application/json" --data "{}"
https://openam.example.com:8443/openam/json/authenticate
{ "tokenId": "AQIC5w...NTcy*", "successUrl": "/openam/console" }
Should I create a class with instance variables "tokenId", "successURL" and passing that as the second parameter to JAXRSClientFactory? Do I need to worry about all of the parameters specified? Once I figure this out, I've got to figure out how to actually pass the user name and password and invoke the service...
Thanks for your help.
This is really more of a JAXRS question, and is not specific to OpenAM. You need to write Java code to make requests and parse the JSON response. JAXRS is one way to do this- but there are others as well.
Look for a good JAXRS tutorial. The OpenAM part is very simple once you understand REST web services.