I used the labelled tool to train my model and got the model ID. Then I tried to make an API call (https://westeurope.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2-preview/operations/AnalyzeWithCustomForm) and use this model ID to analyse form but got the error code 202. My resource (Form Recognizer cognitive service) is in West Europe. Any idea what might be wrong with my request? If I click on the Operation-location from the response, then I see the error code 401.
Is there anywhere I can find a source code for a blob triggered azure function so I can use the model ID I have created using the labelling tool? Thanks.
A 202 response is not an error code, instead it means that your first POST API call was successful. The next step would be to make a GET call (https://westeurope.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2-preview/operations/GetAnalyzeFormResult) using the Operation-Location from your response and the same subscription key you used before.
Related
one of my old project/app was working fine for years, very recently client report that app does not working any longer due to API response issue.
it's just a get request to an API with some parameters..
till date (before issues occurs) it returns following response:
,,3,1669179307,0,
but recently it shows following response: (note nothing is changed in the source php/code files since project start)
<html><title>You are being redirected...</title>
<noscript>Javascript is required. Please enable javascript before you are allowed to see this page.</noscript>
<script>var s={},u,c,U,r,i,l=0,a,e=eval,w=String.fromCharCode,sucuri_cloudproxy_js='',S='bT0nP2RUNCcuc3Vic3RyKDMsIDEpICsgJycgKyAKJz9iVGYnLnN1YnN0cigzLCAxKSArICcnICsgCidIcExjJy5zdWJzdHIoMywgMSkgK1N0cmluZy5mcm9tQ2hhckNvZGUoNTYpICsgJ3FAYycuY2hhckF0KDIpKyAnJyArIAonNycgKyAgICcnICsgClN0cmluZy5mcm9tQ2hhckNvZGUoMHg2MykgKyAgJycgKycnKyIyc3VjdXIiLmNoYXJBdCgwKSsiYyIgKyAiNHNlYyIuc3Vic3RyKDAsMSkgKyAiZW0iLmNoYXJBdCgwKSArICAnJyArIAoiM2MiLmNoYXJBdCgwKSArICIiICtTdHJpbmcuZnJvbUNoYXJDb2RlKDk3KSArICJlIi5zbGljZSgwLDEpICsgICcnICsnZCcgKyAgJ0RiJy5zbGljZSgxLDIpKyAnJyArJycrJ3hJMScuY2hhckF0KDIpK1N0cmluZy5mcm9tQ2hh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9uLnJlbG9hZCgpOw==';L=S.length;U=0;r='';var A='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';for(u=0;u<64;u++){s[A.charAt(u)]=u;}for(i=0;i<L;i++){c=s[S.charAt(i)];U=(U<<6)+c;l+=6;while(l>=8){((a=(U>>>(l-=8))&0xff)||(i<(L-2)))&&(r+=w(a));}}e(r);</script></html>
here is curl screenshot:
And here is the postman screenshot:
and when i check the URL in browser it shows the expected result, though when i check the devtool (network tab), it looks like page is loaded two times.. 1st one provide error (HTML/js) response (read marked) 2nd one provide the expected response (green marked), so, it looks like when it's called directly by curl/postman/c#... fails.. but as browser can do redirect it passed.
here is the browser screenshot:
i am sorry, i added several screenshot to give better idea what is happening.
and here is the URL in question:
https://simpleclienttracking.com/membershipmanager/remotelogvisit.php?locID=1&orgID=1&deptID=1&barcode=8346420
now my question, is how can i use the API code/file to get the direct response as i was getting earlier? do i need to pass any header? update/modify server htaccess file or what?
To test the error in deep, i have tried another URL from another hosting provider, in that case i am passing post request to an URL, and this server response slightly different thing, but looks like core is same, redirect!
here is the response from new/another server:
<script>document.cookie = "humans_21909=1"; document.location.reload(true)</script>
so, it's looks like hosting providers has applied some kind of security for direct URL access?
thanks in advance for any upcoming help
best regards
I am integrating a .Net application with Work-front, I am supposed to create a new user in work-front from API. I have tried the steps mentioned in the link and my code https://{mycompany}.attasksandbox.com/attask/api/user?updates={emailAddr:testuserAPI#domain.com,firstName:testuser,lastName:API}&username=myname#domain.com&password=password&method=post
From my console application I get internal server error 500. From fiddler I get parse error.
https://{mycompany}.attasksandbox.com/attask/api/5.0/user?updates={"emailAddr":"testuserAPI#domain.com","firstName":"testuser","lastName":"sample","roleID":"testrole","password":"pwd123res"}&method=post&sessionID=sdfdsdf1
Above code gives unrecognized URI format: too many parts - exception
Though my requirement is to authorise using API key, I was trying possible ways of achieving it.But I am not able to create in any of the ways.However, I am able to create from UI, which confirms my ID has rights to create user. I did look into API explorer and could see named functions,but whats the approach?Is there any documentation for these complete steps? My search was in-vain. Please suggest as I am new bee to workfront. Thanks in advance!
Update 1:
I was able to create a user via the API authorising by both API key and sessionID. The parameter I missed to pass is username (not necessarily an existing username). My code is -
https://{mycompany}.attasksandbox.com/attask/api/user?updates={"firstName":"Test","lastName":"API","username":"TestAPI#domain.com","emailAddr":"test2#test.com"}&method=post&apiKey=t---------------------u
My first step is resolved. There are 2 more steps which I need to perform. Calling named action - assignUserToken. I tried the code as below and it didn't work
https://{mycompany}.attasksandbox.com/attask/api/5.0/user/ID=4556ffs3324?action=assignUserToken&apiKey=t---------------u&method=put
ID is value returned while creating a user. Error returned is -
{"error":{"class":"java.lang.IllegalArgumentException","message":"null objCode"}}
Can you share the syntax of calling this named action?
Hi Your call has a few things wrong with It
1st you are calling
api/5.0
this needs to be
api/v5.0
2nd you are calling
api/v5.0/user/ID=4556ffs3324
it should be
api/v5.0/user/4556ffs3324
Other then that I dont see anything else wrong with the call.
Creating a user via API is a 3 step process as mentioned in the link but it doesn't have syntax. The syntax and steps are as below.
Create user -
https://{yourcompany}.attasksandbox.com/attask/api/user?updates={"firstName":"Test","lastName":"API","username":"TestAPI#domain.com","emailAddr":"test#domain.com"}&method=post&apiKey=-----0l
This would return a uniqe ID on response. Use this ID value for next step.
Assign userToken -
https://{mycompany}.attasksandbox.com/attask/api/v5.0/user/12345?action=assignUserToken&apiKey=d---l&method=put
ID value is 12345. This would further return a token. Use this token value for next step.
Complete userRegistration- https://{mycompany}.attasksandbox.com/attask/api/v5.0/user/12345?action=completeUserRegistration&updates={"firstName":"Test","lastName":"API","token":"0--ab","title":"testUser","newPassword":"Password01"}&method=put&apiKey=dqy---3
That completes all the process. Now check in workfront UI.
I'm trying to get to grips with OneDrive, using this tutorial:
https://msdn.microsoft.com/en-us/library/hh826529.aspx
When I run in code, it gets as far as the makeAccessTokenRequest function, sending the following requestURL:
"https: //login.live.com/oauth20_token.srf?client_id=[myclientID] &client_secret=[myclientsecret]&redirect_uri=https:// login.live.com/oauth20_desktop.srf&grant_type=authorization_code&code=[authcode]"
(please ignore the spaces after "https:", I had to add them here to allow the question)
[myclientid], [myclientsecret], and [authcode] all appear to be populated correctly. It seems to get a response, as it runs the function "accessToken_DownloadStringCompleted", but throws a "TargetInvocationException" error, The inner message of the error is ""The remote server returned an error: (400) Bad Request.".
Could anyone throw any light on this? I'm completely new to this, so apologies if my question makes no sense, or is irritatingly vague..
Requests to the oauth20_token.srf end point need to be a POST with the parameters in the body of the post, instead of the query string. Since you didn't mention what code you're using to build the HTTP request it's hard to provide an example, but take a look at RedeemAuthorizationCodeAsync in my sample OAuth 2 project for an idea.
The outgoing request should look like this:
POST https://login.live.com/oauth20_token.srf
Content-Type: application/x-www-form-urlencoded
client_id={client_id}&redirect_uri={redirect_uri}&client_secret={client_secret}&code={code}&grant_type=authorization_code
You may also find this tutorial easier to follow than the one you linked with: https://dev.onedrive.com/auth/msa_oauth.htm.
If you are doing something with OneDrive (you tagged the post OneDrive) then you may want to consider using the OneDrive SDK instead. It includes authentication for several types of .NET projects so you don't need to figure out how to do auth yourself.
Im using Facebook C# SDK to post and fetch data. These simple tasks took forever to get running properly. Now I need to notify my webpage(ASP.NET C#) about changes on the specific facebook page so the webpage knows then it should fetch new data.
I have looked at this page : https://developers.facebook.com/docs/graph-api/real-time-updates/v2.2
But as usally with facebook documentations it misses to explain in detail how it works and how to get it working. Where exacly do I create the subscriptions? It says /{app-id}/subscriptions but I have tried this url with my app-id but no page is found?
I have tried to find examples on how to set this up but to no sucess.
Could someone please explain how this works? What do I need to do exacly to get this running?
Facebook subscription works by pinging a URL you own every time data has changed. You need to add a URL you own as a callback URL for Facebook subscriptions to work with
POST /v2.2/{app-id}/subscriptions HTTP/1.1
Host: graph.facebook.com
object=page
callback_url=http%3A%2F%2Fexample.com%2Fcallback%2F
fields=feed
verify_token=thisisaverifystring
In the above API request a POST request is made to add http://example.com/callback/ as the callback URL subscribing to the feed edges of the page object (a page object that the session user owns)
In your callback URL you must have it handle two actions
the initial callback (Handling Verification Requests via the verify token)
saving updated subscriptions (Receiving the Real Time Updates)
Here is an example of what it looks like in PHP
<?php
if ($_REQUEST['hub_verify_token'] === 'thisisaverifystring') {
echo $_REQUEST['hub_challenge'];
}
$file = 'sample.txt';
$inputJSON = json_decode(file_get_contents('php://input'));
file_put_contents($file, file_get_contents('php://input') );
?>
I'm just trying to make an yahoo boot that send to registered user of my application an instant message. I've spent some hours searching the web on how to do it but yahoo developer documentation sucks.First of all I don't know what servers I should use for authorization, log in, and messaging. I have a consumer key and I've tried to follow this steps but nothing works.
Any advice/suggestion is welcome.
The documentation looks to be very good, I think the issue here is that your knowledge of how REST API's work in general is a bit lacking.
Let's talk about diagram #2: Get a request token using: get_request_token.
get_request_token is part of an HTTP endpoint, and in their diagram they want you to pass in a handful of parameters to validate your request.
oauth_consumer_key
oauth_nonce
oauth_signature_method
etc
(If you need more clarification of any step you can find it in the tree view on the left hand side of the page)
The request URL:
https://api.login.yahoo.com/oauth/v2/get_request_token.
Now at this point you can either use the HTTP GET or POST verb. If you decide to use GET you will need to include those above parameters as a query string.
?oath_consumer_key=myConsumerKey&oauth_nonce=oathNonce etc
I will leave it to you to write the associated C# code. You'll want to start off with the HttpWebRequest.Create() method